[Owncloud] Re: Templating engine or not?

Charles-Edouard Coste contact at ccoste.fr
Mon Nov 15 10:52:31 UTC 2010


Hi everyone.

This is my point of view:

Template engines may make the application slower when compiling
templates.

But:
Template engine are better for team work because it adds an abstraction
layer for content rendering.
It's also more safe, because Html coders won't be able to access
dangerous functions like "unlink()", "chmod()", and so on...

Like François said PHP as its own template language. Usually, we should
use tags like:
<?php if( $hello ) : ?>
  <h1>Hello</h1>

instead of
<?php if( $hello ) { ?>
  <h1>Hello</h1>
<?php }; ?>

...as I suggested in this commit :
http://gitorious.org/owncloud/charlycostes-owncloud/commit/d726340c96602ce6b83f02a194a4981e833d5694

So maybe it's possible to make it more readable for you Bugsbane. But in
general, I agree with you : template engine is better.

-- 
Charles-Edouard Coste <contact at ccoste.fr>

Le lundi 15 novembre 2010 à 10:39 +0100, François K. a écrit :
> Hi !
> 
> @Bugsbane : I might have misread your email but it seems like you forgot to mention *why* you "would not have a chance of creating anything useful if [you] had to work with straight PHP".
> Can you be more precise ? :)
> 
> Again, I personnaly don't see any difference, designers who don't understand PHP just have to ignore everything that's between <?php ?> tags. By the way, the PHP code in the view file should be really easy to understand since it should only be basic "if else", "foreach" and "echo" statements, nothing really hard to figure out.
> 
> I think we need more opinions !
> 
> Best regards,
> 
> -- 
> François
> 
> 
> 
> ----- Mail Original -----
> De: "Bugs Bane" <bugsbane at gmail.com>
> À: "owncloud" <owncloud at kde.org>
> Envoyé: Samedi 13 Novembre 2010 02h10:17 GMT +01:00 Amsterdam / Berlin / Berne / Rome / Stockholm / Vienne
> Objet: [Owncloud] Re: Templating engine or not?
> 
> 
> Speaking as a designer, 
> 
> I've created the visual design for various projects using Joomla (mainly), Drupal and Magento. The ease of the template system plays a very large part in my decision of which CMS I am going to use for a project and I would not have a chance of creating anything useful if I had to work with straight PHP. For these reasons I *love* Joomla and despise Magento. Why? Because in Joomla the vast majority of any template is just html in the index.php file and css in the template.css file. Any PHP that does exist in there is typically one short, standard code snippet to include a module (similar to blocks in Drupal). I don't really need to know any code beyond 1 or two snippets and CSS. Compare this to the nightmare that is Magento where code is flung around multiple files in multiple locations and you need to know what just about all of them do to estimate why something looks the way it does and how to change it. Drupal is somewhere in the middle, albeit much better than Magento. Strangely enough, over 90% of websites (including http://krita.org ) that I've been in charge of creating use Joomla. 
> 
> Now I don't know if what's in Joomla a coder would call a "templating engine" or not. I don't really know what's meant by the phrase. What I know is that HTML, CSS, Gimp and Inkscape are familiar and need no introduction. Every other file and protocol that's introduced is other specialty learning I'd have to study before helping out (ie a barrier to entry). 
> 
> Cheers 
> 
> Bugsbane / Kubuntiac 
> 
> 
> On Tue, Nov 9, 2010 at 6:21 AM, François K. < daitheflu at free.fr > wrote: 
> 
> 
> Hi, 
> 
> As I said yesterday on IRC, I'm strongly pro separating views and treatments as far as we can. But I'm also strongly against templating systems. Here is why : 
> 
> - PHP is a templating system. Includes and the alternative syntax are made for that ( http://php.net/manual/en/control-structures.alternative-syntax.php ). As a consequence, most templating systems are just re-inventing the wheel : PHP works already well and has no limitations. 
> - It forces us to learn a new language. 
> - I don't think they make things easier for webdesigners (just look at some template code, it's the same). 
> - I also think that webdesigners have to have a basic knowledge of PHP to do a proper work :P 
> - It adds a strong dependency. What if the templating system we chose isn't maintained anymore (that could be in 2 or 3 years, who knows) ? 
> - It may decrease performances (this is arguable). 
> 
> I used to build my websites with a templating system and, I now see that the gain is null. 
> 
> However, just like Frank, if a majority of people wants it, just go on with the chosen one :) 
> 
> Cheers, 
> 
> -- 
> François 
> 
> 
> 
> 
> 
> ----- Mail Original ----- 
> De: "Frank Karlitschek" < karlitschek at kde.org > 
> À: info at s8inac.org 
> Cc: "owncloud" < owncloud at kde.org > 
> Envoyé: Mardi 9 Novembre 2010 11h54:02 GMT +01:00 Amsterdam / Berlin / Berne / Rome / Stockholm / Vienne 
> Objet: [Owncloud] Re: Templating engine or not? 
> 
> 
> 
> 
> Hi, 
> 
> 
> I´m personally not a big fan of templating engines in PHP for stuff beside 
> static webpages like corporate websites. 
> 
> Sometimes they are not powerful enough and limit the functionality of the frontend. 
> Or they are powerful and are something like a programming language inside a programming language. 
> Which is a bit stupid in my opinion because PHP was developed to be exactly that. :-) 
> 
> And webdesigners also have problems to contribute because they have to learn the complex template language. 
> 
> So I´m personally not a big fan of this idea but if the majority wants to do this please go forward. 
> 
> 
> Cheers 
> Frank 
> 
> 
> 
> 
> On 09.11.2010, at 11:36, info at s8inac.org wrote: 
> 
> > Hey, 
> > 
> > yesterday we had a discussion on irc about templating engine or not. 
> > We all agreed we have to seperate views. 
> > But how was the question. 
> > 
> > Lets start with pro for templating: 
> > - easier way to seperate application logic and views (think about MVC) 
> > - webdesigners could contribute this project 
> > - ... 
> > 
> > and contra: 
> > - dependency on 3rd party software 
> > - isn't php a template system? 
> > - ... 
> > 
> > We would prefer PHPTAL as a templating engine beacause i have 
> > experience with it. 
> > 
> > What do you think? 
> > 
> > kinds regards 
> > - Simon 
> 
> 
> 




More information about the Owncloud mailing list