Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Basically, I think that template engines suck.
Goto page Previous  1, 2, 3  Next
 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
marccho
Smarty Rookie


Joined: 02 Jan 2004
Posts: 12
Location: Barcelona/Catalonia

PostPosted: Mon Jan 05, 2004 11:44 am    Post subject: Reply with quote

Quote:
Can you suggest an alternate framework that would make things simpler? You mentioned "caching with divs", no idea what that is, I'll have to look that up if I want to use caching without Smarty.

I didn't say so. I just said that independently you can cache your templates and use divs. These two things are very recommendable and don't have much to do with the point here.

Quote:
What about security? If templates are basically PHP files that only display or include other templates, what would stop the template designer (which could be a webdesigner, content editor or a store owner in a multi-user e-commerce system) from writing hazardous or stupid code? These templates would have to be parsed somehow to screen for that.


Roses are red, blue is the sky, and only programmers should code.

Quote:
I like the idea, really, but I still think people want a framework to keep things organized and easier. Just come up with one and we'll see if it's better than using a template engine.


The only way to learn a language is practising it. If you want to keep things organized and easier just do so. Use classes, reuse code, find a good set of public classes or whatever you want but, I'm sure you don't need to lose your cpu's precious time parsing twice.
Back to top
View user's profile Send private message
Gerald
Smarty Regular


Joined: 26 Nov 2003
Posts: 53
Location: Lyon [France]

PostPosted: Mon Jan 05, 2004 12:00 pm    Post subject: Reply with quote

Quote:
You can simply write <?= $variable ?>. Not a good start.


In fact, I never enable short tags as I don't want issues dealing with xhtml / xml. "<?xm"l would raise a parse error.

So i'm using <?php echo something if I really want to echo something.
Actually, not that bad a start, just a way of doing something.

for the control structures and so on..... I won't argue anymore... I don't see how you could come not using them to display array.

I'll look for your post with your solution (I mean a complete example) to show me I'm wrong.

Still, I've been using Smarty for 2 years now...... and I never felt like I was wasting my time, especially when it comes to reuse/upgrade things. I'm smiling casting a glance at my old "non templated applications" (when it comes to real applications, not "home pages" or something).
Back to top
View user's profile Send private message Visit poster's website
marccho
Smarty Rookie


Joined: 02 Jan 2004
Posts: 12
Location: Barcelona/Catalonia

PostPosted: Mon Jan 05, 2004 12:18 pm    Post subject: Reply with quote

Quote:
In fact, I never enable short tags as I don't want issues dealing with xhtml / xml. "<?xm"l would raise a parse error.


I use them since years ago and never had a problem.

Quote:
for the control structures and so on..... I won't argue anymore... I don't see how you could come not using them to display array.


I agree in that you don't see. And in stop argueing too.

Quote:
Still, I've been using Smarty for 2 years now...... and I never felt like I was wasting my time, especially when it comes to reuse/upgrade things. I'm smiling casting a glance at my old "non templated applications" (when it comes to real applications, not "home pages" or something).


I'm happy using templates too but I feel sad seeing like others lose their cpu's time.

I'm coding a very complex site similar to download.com or amazon.com prepared to serve 100 millions pages every month and believe me: I would be DEAD using smarty parsing.
Back to top
View user's profile Send private message
BRDude
Smarty Rookie


Joined: 23 Nov 2003
Posts: 17

PostPosted: Mon Jan 05, 2004 5:09 pm    Post subject: Reply with quote

marccho, Microsoft satanism aside, "framework" is what I used to describe the set of features Smarty provides out-of-the-box. It's very refreshing when you can get them all up and ready to deploy by just doing an include('Smarty.class.php') and $template = new Smarty().

Regarding your alegations of colossal waste of cpu cycles with Smarty, this engine sets itself apart from others exactly for its efficiency through its ability to pre-compile templates, cache them and provide very fine-grained control over cacheability (geez, what else can you ask for?). It's what makes Smarty so much faster, just look at the actual benchmarks.

Quote:
The only way to learn a language is practising it. If you want to keep things organized and easier just do so. Use classes, reuse code, find a good set of public classes or whatever you want but, I'm sure you don't need to lose your cpu's precious time parsing twice.

You're so worried about saving CPU cycles that take a few nanoseconds each. I think my time wasted coding and researching is worth SO MUCH MORE. I asked you for a "framework" and what you suggest is that I take even more time learning the intrincacies of PHP (which I've been doing for the past 4-5 years), run around fetching public classes, rather than save myself a few months of coding by using a dreaded template engine like Smarty so I can save a few CPU cycles instead.

You're so obsessed with CPU use, it sounds hipocritical, no offense. Why bother wasting your time with such an absurdly inefficient interpreted language as PHP then? Code your website in Delphi, C++ or Assembly.

You don't have to answer that. I know that you like PHP because it provides a set of features out-of-the-box (there's that word again!) that are very useful in developing web applications. It's the same argument I use with Smarty: if I want to separate code and design, Smarty readily provides much more control over that than just PHP itself.
Quote:
Roses are red, blue is the sky, and only programmers should code

That's cute, but you didn't answer the question: if, like YOU suggested, designers are going to deal with templates that use PHP tags, what's STOPPING them from coding (since PHP is a programming language)? That's why I posed this as a security problem.

In Smarty, you can just disable PHP parsing altogether and voilà! Designers are left with only harmless Smarty tags to play with.

About your "designers shouldn't code" dogma that they should run away screaming from control structures (which btw are in Smarty basically to decide how stuff should be RENDERED), I'll just repeat myself by saying it's a mostly arbitrary fine line between logic and appearance.

Webdesigners nowadays are required to understand Javascript, FLASH and DHTML, which all require programming knowledge anyways.
Back to top
View user's profile Send private message
marccho
Smarty Rookie


Joined: 02 Jan 2004
Posts: 12
Location: Barcelona/Catalonia

PostPosted: Mon Jan 05, 2004 6:09 pm    Post subject: Reply with quote

Quote:
marccho, Microsoft satanism aside, "framework" is what I used to describe the set of features Smarty provides out-of-the-box. It's very refreshing when you can get them all up and ready to deploy by just doing an include('Smarty.class.php') and $template = new Smarty().


Maybe you are talking about a public set of classes also known as a public library. YOU DON'T NEED A TEMPLATE ENGINE TO SAVE TIME REUSING CODE. Furthermore, I have to repeat that smarty doesn't encourage you to reuse your rendering code!

Quote:
Regarding your alegations of colossal waste of cpu cycles with Smarty, this engine sets itself apart from others exactly for its efficiency through its ability to pre-compile templates, cache them and provide very fine-grained control over cacheability (geez, what else can you ask for?). It's what makes Smarty so much faster, just look at the actual benchmarks.


You don't understand, I can cache my templates too as precisely as I want, assigning them expiration times for example. You can use a public cache class or program your own as I do. I don't care how well done is smarty, simply the fact that it parses it's a waste of time to me. I don't care how fast it is, I'm always faster.

Quote:
You're so worried about saving CPU cycles that take a few nanoseconds each. I think my time wasted coding and researching is worth SO MUCH MORE. I asked you for a "framework" and what you suggest is that I take even more time learning the intrincacies of PHP (which I've been doing for the past 4-5 years), run around fetching public classes, rather than save myself a few months of coding by using a dreaded template engine like Smarty so I can save a few CPU cycles instead.


I laught at your nanoseconds, really. And I didn't say you don't have to research....I also investigate and I thing you missed the point here. The time one spends researching has nothing to do with the time your cpu spends rendering a page.

By using smarty you waste A LOT OF CPU power and you safe no time programming as long as you use OO and a public library instead.

Quote:
You're so obsessed with CPU use, it sounds hipocritical, no offense. Why bother wasting your time with such an absurdly inefficient interpreted language as PHP then? Code your website in Delphi, C++ or Assembly.


Just because it's not so worth doing it. Please, don't use this kind of argument "you don't like white, why you don't use black?". I use grey man.
I am not obsessed, it's just that I will not do something that I think it's a waste of time if I DON'T NEED TO DO IT.

Quote:
That's cute, but you didn't answer the question: if, like YOU suggested, designers are going to deal with templates that use PHP tags, what's STOPPING them from coding (since PHP is a programming language)? That's why I posed this as a security problem.
In Smarty, you can just disable PHP parsing altogether and voilà! Designers are left with only harmless Smarty tags to play with.
About your "designers shouldn't code" dogma that they should run away screaming from control structures (which btw are in Smarty basically to decide how stuff should be RENDERED), I'll just repeat myself by saying it's a mostly arbitrary fine line between logic and appearance.


You let non programmers program: THAT'S MUCH MORE THAN A SECURITY PROBLEM.

There's nothing arbitrary, you don't know the difference between programming and designing? If you use ifs or whiles then you are programming. Programming rendering algorithms IS programming.

Quote:
Webdesigners nowadays are required to understand Javascript, FLASH and DHTML, which all require programming knowledge anyways.


And IMHO that's a big error and anyway this doesn't imply that they have to do it.

Your single argument here is "I use smarty because I like its set of functionalities". I just say that you don't need a template engine, you don't need to parse html searching for tags, you don't need to interpret a pseudo language to do so. I think you confuse very easly "template engine" and "public library", and "programming" and "designing".
Back to top
View user's profile Send private message
BRDude
Smarty Rookie


Joined: 23 Nov 2003
Posts: 17

PostPosted: Mon Jan 05, 2004 6:26 pm    Post subject: Reply with quote

This is going nowhere. I'm being humble and understanding, yet you accuse me of not understanding basic concepts, which is offensive. No hard feelings, let's just agree to disagree.
Back to top
View user's profile Send private message
marccho
Smarty Rookie


Joined: 02 Jan 2004
Posts: 12
Location: Barcelona/Catalonia

PostPosted: Wed Jan 07, 2004 10:03 am    Post subject: Reply with quote

Quote:
I'm being humble and understanding.


I don't think so.

Quote:
yet you accuse me of not understanding basic concepts which is offensive.


I didn't mean to offend you but this can be offensive as long as you want to be offended because you ran out of arguments maybe. For instance, you said:

Quote:
I'll just repeat myself by saying it's a mostly arbitrary fine line between logic and appearance.


I think this is wrong, logic is logic, rendering logic is logic and color, style or disposition is not logic. If you think that the fact that I don't agree with you is offensive then I think you have a problem.

Quote:
No hard feelings, let's just agree to disagree.


My single motivation it was to motivate people to think beyond the "how can you live without smarty??!!" hype:

If:

- Templating is easily accomplished without an external engine.
- Templating is a development style and architectural decision; not an additional piece of software.

Then:

- Why learn another syntax that has it's own quirks and limitations?
- Why lose a lot of time processing and parsing templates?
- Why lose time developing and maintaining an additional layer of software?
- Why program inside templates when the main motivation of templating is to remove programming from templates?
- Why not use Object Oriented Programming to separate rendering code from the rest of the code and from HTML code?
- Why let non programmers code rendering logic?

...

Yet Another Smarty Enthusiast.
Back to top
View user's profile Send private message
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Mon Jan 12, 2004 9:11 pm    Post subject: Reply with quote

Marccho enjoys talking to himself. Marccho has no new or intelligent ideas to share. Marccho has no legitimate business here.

The next person who claims that PHP is itself a templating language should do so with the understanding that they are harking back to the days of PHP2 and 3 when that was true. Then, the idea was that you'd encapsulate your business logic in C modules which would feed PHP's processing. That provided separation of two types of unrelated logics -- logic and processing. Some still do that, but the VAST majority of PHP coding doesn't work like that these days, many applications being written entirely in PHP. To regain the same separation, these aspects of design need to be reconsidered and Smarty provides one avenue to address that need. Sure, boring 10 line scripts hardly need Smarty, but sophisticated, maintainable and large applications often do require the types of features that Smarty brings to bare.

Marccho, stop spouting at the mouth and try to understand the tools at hand a bit better. Make sure you know you programming languages and techniques as well as you claim to know natural languages. One more thing--you DO have to read to understand and participate in discussions. Asserting that you don't like to hear that argument only underlines your disrespect for those of us who have spent considerable time analyzing and working with these issues.
Back to top
View user's profile Send private message
marccho
Smarty Rookie


Joined: 02 Jan 2004
Posts: 12
Location: Barcelona/Catalonia

PostPosted: Fri Jan 16, 2004 4:09 pm    Post subject: Reply with quote

Nothing to quote.

Wow, you are great man, if I just wanted I wouln't had been able to say something more stupid.

You are the boss. I agree with everything you may say, until my ears bleed.
_________________
Templating, like object oriented programming is not a piece of software.
Back to top
View user's profile Send private message
adamastor
Smarty n00b


Joined: 02 Feb 2004
Posts: 1

PostPosted: Mon Feb 02, 2004 7:55 pm    Post subject: Reply with quote

Well, I'm afraid I have to agree with marccho.

I'm using PostNuke and downloaded a module called Xanthia Templating Environment. This module replaces the default "display" logic of PostNuke with Smarty.

Before installing this module, my homepage (in a testserver) took 0,9s to load.

With Smarty the homepage now takes 2,1s. Exact Same content! Try It! Just folow those links.

This is not just some nanoseconds, and is just one simple request! Now, I've never used Smarty, and maybe I'm doing something wrong, so I would like to invite you to find the problem.

I was considering Smarty, but with these "nanoseconds" no thanks!
Back to top
View user's profile Send private message
MrSlayers
Smarty n00b


Joined: 04 Feb 2004
Posts: 1

PostPosted: Wed Feb 04, 2004 10:03 am    Post subject: Reply with quote

Hi !
I write my text in French because the author understand French Wink

Bon meme si je ne comprend pas tout l'anglais j'ai l'impression que ce topic est du "troll".
Je suis nouveau dans l'utilisation de Smarty mais je dois dire que j'aime smarty !! Avec Smarty je divise le temps de chargement de mes page par 8 !!

Passer de 150 ms à 18 ms pour les pages ce n'est pas rien !! (bien sur il faut utiliser le cache) .

Apres pour ce qui est de la charge CPU, forcement ca doit utiliser plus (perso j'ai pas encore vu de différence) mais il y a surement moyen d'optimiser ses pages Wink.
Back to top
View user's profile Send private message
devnul
Smarty Rookie


Joined: 26 Aug 2003
Posts: 32

PostPosted: Sat Feb 07, 2004 1:39 am    Post subject: Reply with quote

This point that you are missing (and I am surprised nobody has specifically made it):

Smarty parses the template and creates a PHP-scripted HTML page. From then on, the PHP-scripted page is used just as if you had sat down and wrote it yourself. When the template is updated, it gets parsed one (and only) one time to create the PHP code.

All of that being said, I've been using Smarty for some time now and can definitely say that it has *radically* improved my productivity.

To consider Smarty a templating system is not really accurate - as pointed out by someone else it is actually more of a development framework. I'm surprised you can't see this - have you read the documentation or downloaded/installed it?


As a final point, considering something like this:

Code:

#1. <input name="somename" value="{$somename}">

as opposed to:

#2. <input name="somename" value="<?= $somename ?>">



This bit of code (in #2) will almost always end up result in parsing errors in virtually any WYSIWYG editor (by WYSIWIG, I mean the type of editors most designers seem to prefer to use). In fact, many will rewrite this: "<?= $somename ?&". The {} are a *much* friendlier to these type of editors. I'd rather not have to be overly concerned with what type of editor a designer or customer wants to use.

In case it is not obvious: I really think you are *really* off-base in your statements and do not understand what Smarty actually is.

Greg Saylor
Senior Systems Integrator
Back to top
View user's profile Send private message Visit poster's website
devnul
Smarty Rookie


Joined: 26 Aug 2003
Posts: 32

PostPosted: Sat Feb 07, 2004 1:48 am    Post subject: Reply with quote

Whoops someone did make my point.. Sorry, I didn't make it to the second page when I posted that... Smile

As for PostNuke: I would suspect that this has very little to do with Smarty itself. It is probably the way the module was written (either that or you do not have Smarty configured correctly). I've not developed any Smarty templated page which has taken longer then .25 seconds to render - and most of that is usually in database accesses/etc which would need to be done if Smarty were being used or not.

Greg Saylor
Senior Systems Integrator
Back to top
View user's profile Send private message Visit poster's website
mikeken
Smarty Regular


Joined: 13 Aug 2003
Posts: 57
Location: MN

PostPosted: Tue Feb 10, 2004 4:30 am    Post subject: Reply with quote

Just to put my 2 cents in on this. Marccho, please grow up. Why are you so mad because of something that you are not even forced to use? So immature.

Anyways, dont know if this point was posted yet but, suppose this scenario.
Php programmer with no designing skills what so ever. Really good designer with no php skills...get the pictures?

--Mike.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address
markwest
Smarty n00b


Joined: 11 Jun 2003
Posts: 3

PostPosted: Wed Feb 11, 2004 11:23 pm    Post subject: Reply with quote

adamastor wrote:
I'm using PostNuke and downloaded a module called Xanthia Templating Environment. This module replaces the default "display" logic of PostNuke with Smarty.

I was considering Smarty, but with these "nanoseconds" no thanks!


Not strictly on topic for this thread but as a developer on the postnuke project i'll add this here. The problem here isn't smarty itself which is as quick a template engine as you'll find. The currently released version of the Xanthia module does have performance issues as you say but this is down the inefficiences in the module itself with regard to database accesses for things like theme zone, settings and palettes.

The next release with have significant performance increases with the number of database accesses significant reduced.

In addition for optimum performance make sure you have Xanthia in production mode (i.e. check for updated templates and force compile off) otherwise your adding unneeded overhead to the process. Best place to continue this conversation would be here.

Don't let these issues (for what is a not production ready code anyway) prevent you from considering smarty for other projects.

-Mark
_________________
Mark West
PN Development Team
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP