The Daily WTF: Curious Perversions in Information Technology
Welcome to TDWTF Forums Sign in | Join | Help
in Search

That's what SMARTY were designed for...

Last post 07-17-2008 1:13 AM by ammoQ. 82 replies.
Page 2 of 2 (83 items) < Previous 1 2
Sort Posts: Previous Next
  • 07-15-2008 4:55 PM In reply to

    Re: That's what SMARTY were designed for...

    Locked Reply Contact

    archivator:
    I realize that this is kind of an out-of-place comment but I just have to ask: what about caching?

    AFAIK, Smarty has a built-in cache mechanism that (supposedly) reduces load times by bypassing reevaluation of the template. While I'm with the "PHP is itself a template language" crowd on the main topic, I keep wondering how this caching can be (easily) achieved in pure PHP.

    Anything obvious that I'm missing?

    The caching has to be used with Smarty because it is a template system built on top of PHP.  PHP itself is already a fairly fast, VM-based language so the speed should be better.  However, PHP also has the option of using an opcode cache which prevents re-parsing of the PHP code.  This would give something like a 10x performance improvement and will definitely outperform Smarty.  Remember, Smarty is built on PHP and it is practically impossible for it to outperform the native PHP templating. 

    Tired of incompetent moderation?
    Wondering where all the clever discussion went?
    Try irc.slashnet.org #TDWTFMafia.
    We don't ban or kick and everyone is welcome.*

    *Stupid people will be mocked mercilessly and encouraged to commit suicide, however.
  • 07-15-2008 4:56 PM In reply to

    • DOA
    • Top 75 Contributor
    • Joined on 06-26-2007
    • Posts 292

    Re: That's what SMARTY were designed for...

    Locked Reply Contact

     

    belgariontheking:
    DOA:
    Amusingly enough I'm the only one in this little flamewar stupid enough to have actually used a 3rd party template engine.
    I am yet another clueless sheep following the flow. As such I have no real arguments and my only option is to spout random insults. This doesn't really help me, but it's a good diversion from unpleasant activities like having to form an opinion by trying things for myself.
    FTFY

    bstorer:
    I was trying to convince some people last week that sugar works better in cars than gasoline. Amusingly enough, I was the only one in that little flamewar to put sugar in my gas tank.
    Yes that's the exact same thing like trying new technologies.

  • 07-15-2008 5:15 PM In reply to

    Re: That's what SMARTY were designed for...

    Locked Reply Contact
    DOA:
    bstorer:
    I was trying to convince some people last week that sugar works better in cars than gasoline. Amusingly enough, I was the only one in that little flamewar to put sugar in my gas tank.
    Yes that's the exact same thing like trying new technologies.

    I don't try new technologies just because they're new. I expect whoever is evangelizing said technology to provide a good reason to use it. Thus far, you've provided zero reasons to use Smarty, save for vague half-assed statements. In fact, all you've really accomplished thus far is to thoroughly discredit yourself, by being completely incapable of responding to a single valid criticism.

    Now, even though I don't have years of Smarty experience, I am not unfamiliar with it. I see what it does, and I'm unimpressed. The only things it has going for it are:

    • Designers can't use all of PHP - That's great, but it's really not a primary concern. If it were a concern, I'd just restrict what they can do on the back end anyway.
    • It has a bunch of common functions for stuff like making tables with alternating colors - Such functions are useful, but they don't warrant an entire template system.
    Now I'll ask you again, what great feature am I missing?

  • 07-15-2008 5:35 PM In reply to

    • DOA
    • Top 75 Contributor
    • Joined on 06-26-2007
    • Posts 292

    Re: That's what SMARTY were designed for...

    Locked Reply Contact

    bstorer:
    Now I'll ask you again, what great feature am I missing?
    You're asking me what's the point of a template engine 50+ posts later? Seriously?

    I would tell you, like I told everyone else, to actually try it for yourself and form your own opinion, but you know what? If you hate the idea with such a passion, just don't use the bloody thing.

  • 07-15-2008 5:35 PM In reply to

    Re: That's what SMARTY were designed for...

    Locked Reply Contact

    bstorer:
    Now I'll ask you again, what great feature am I missing?
     

    Your problem is trying to argue with DOA. Like a few other recent members, he is not here to provide backup to ridiculous arguments he makes.

    Instead, he will make a ridiculous statement, and then jump all over the "you're a troll!" and "people who use insults lose the argument!" bandwagons. It is a pattern of behavior he has used for a while now.

     

    Interestingly enough, he uses the same "Why should you use it? Try it, and you will know" argument that other clueless, brainwashed people do. IOW, he doesn't know why he uses it. But he does, and he feels he needs to defend that and even try and convert some more people into brainwashed zombies.

     

    I advise you give up. He will never actually answer anything, he will just jump all over the aforementioned bandwagons and stir a small reaction from other clueless people who simply want to defend him because everyone is calling him stupid.

    Yes, I have been banned. Thanks to all for a good time.

    Tired of incompetent moderation?
    Wondering where all the clever discussion went?
    Try irc.slashnet.org #TDWTFMafia.
    We don't ban or kick and everyone is welcome.*

    *Stupid people will be mocked mercilessly and encouraged to commit suicide, however.
  • 07-15-2008 5:44 PM In reply to

    Re: That's what SMARTY were designed for...

    Locked Reply Contact

    DOA:
    I would tell you, like I told everyone else, to actually try it for yourself and form your own opinion, but you know what? If you hate the idea with such a passion, just don't use the bloody thing.
    I've never used either one (most of my web experience has been JSF), but based upon what I've heard in this thread, there's no compelling reason to consider smarty.  A quick browse of their page tells me that it basically is there to enforce separating presentation and business logic, which is apparently already possible (though not enforced) in PHP.  Is there some other magic that happens with smarty?  Something that PHP doesn't have?

    Otherwise, keep it going, this is a really amusing thread to read.

    Filed under:
  • 07-15-2008 5:51 PM In reply to

    Re: That's what SMARTY were designed for...

    Locked Reply Contact
    DOA:
    bstorer:
    Now I'll ask you again, what great feature am I missing?
    You're asking me what's the point of a template engine 50+ posts later? Seriously?

    I asked you all the way back here, in my second fucking post in this thread. You've yet to provide anything approximating an answer.

    DOA:

    I would tell you, like I told everyone else, to actually try it for yourself and form your own opinion, but you know what? If you hate the idea with such a passion, just don't use the bloody thing.

    Look, if you can't answer the question, just say so. I don't need to try it: I've just given you a clear cut explanation of why I see no need for it. You seem to vehemently disagree, but you can't give me a single justification. MPS has you pegged completely; you're not even sure why you use Smarty, are you? You just feel the need to defend it, but you're way out of your depth. You decide instead to opt for nonsense statements like "Do you even know what a template engine is?" which have no bearing on the conversation, and only demonstrate that you don't understand enough even to know why you're wrong.
  • 07-15-2008 5:55 PM In reply to

    • DOA
    • Top 75 Contributor
    • Joined on 06-26-2007
    • Posts 292

    Re: That's what SMARTY were designed for...

    Locked Reply Contact

     

    MasterPlanSoftware:
    <defamation, twisted facts and half-assed attempts at stereotyping>
    Just when I thought you couldn't fall any lower. Oh, and keep locking your posts. It's much easier to post inaccurate drivel without being called on it. 

  • 07-15-2008 6:11 PM In reply to

    Re: That's what SMARTY were designed for...

    Locked Reply Contact

    morbiuswilters:

    Carnildo:
    This confusion is what's causing the flame war here.

    Wrong.  The flamewar is because DOA seems to think he needs a templating language on top of PHP and everyone else realizes that PHP has templating built into it.  End of story.

    Isn't this a case of the "Inner Platform Effect" ??? You know ... starting with some neat API, then growing it big enough that it essentialy becomes a half-baked version of the platform it sits on top of? Kind of like doing taglibs that invoke ... taglibs on Java.
  • 07-15-2008 6:14 PM In reply to

    Re: That's what SMARTY were designed for...

    Locked Reply Contact

    archivator:
    I realize that this is kind of an out-of-place comment but I just have to ask: what about caching?

    AFAIK, Smarty has a built-in cache mechanism that (supposedly) reduces load times by bypassing reevaluation of the template. While I'm with the "PHP is itself a template language" crowd on the main topic, I keep wondering how this caching can be (easily) achieved in pure PHP.

    Anything obvious that I'm missing?
     

    tip one: If your looking for a caching solution, don't install a templating engine.

    There are many caching solutions too choose from, zend platform has some very good options, especially the partial page caching which works a bit like the php output buffering interface, but instead lets you cache what's in between. Then if you don't have the money for ZP,  zend framework also gives you a few, very easy to use solutions to do your caching. A special mention should probebly go out to memcache because if your building any kind of high preformance site you really want to use that. But really just google php and caching.

    Also not all caching has to be in your code, installing a reverse proxie can give you a massive advantage against high traffic.

     

    Also while i personally don't really see the use for smarty, it does get used a lot, don't ask me why. But in the end its not all that bad, its just a bit like a fifth wheel. It solves some problems better solved by other software and gives you a templating language you don't need.

    It also gives interesting problems when having to integrate two seperate systems that both have their own smarty. (*looking at you serendipity*)

    "Show me a sane man and I will cure him for you." - C. G. Jung
  • 07-15-2008 6:20 PM In reply to

    Re: That's what SMARTY were designed for...

    Locked Reply Contact

    danixdefcon5:
    Isn't this a case of the "Inner Platform Effect" ???

    That is precisely what this is.  Everyone but DOA seems to see that.

    Tired of incompetent moderation?
    Wondering where all the clever discussion went?
    Try irc.slashnet.org #TDWTFMafia.
    We don't ban or kick and everyone is welcome.*

    *Stupid people will be mocked mercilessly and encouraged to commit suicide, however.
  • 07-16-2008 1:22 AM In reply to

    Re: That's what SMARTY were designed for...

    Locked Reply Contact

    morbiuswilters:

     TRWTF is Smarty.  Why do we need a template language for PHP which is itself a template language?

     

     

    Because I hate the visually nausiating:

    &lt;?php echo $foo ?&gt;

    compared to a cleaner:

    {$foo}

    The php powers that be seem to frown on the short tags which would make php templates so much cleaner.

     

  • 07-16-2008 4:06 AM In reply to

    • DOA
    • Top 75 Contributor
    • Joined on 06-26-2007
    • Posts 292

    Re: That's what SMARTY were designed for...

    Locked Reply Contact

     

    morbiuswilters:
    danixdefcon5:
    Isn't this a case of the "Inner Platform Effect" ???
    That is precisely what this is.  Everyone but DOA seems to see that.

    Assuming a handful of people are "Everyone" . Still it doesn't change this simple fact:

    Arguing about a technology you have zero hands-on experience on = talking out of your rear

  • 07-16-2008 5:15 AM In reply to

    • Zagyg
    • Not Ranked
    • Joined on 03-07-2008
    • Posts 39

    Re: That's what SMARTY were designed for...

    Locked Reply Contact

    DOA:

    Arguing about a technology you have zero hands-on experience on = talking out of your rear

    But surely also: Thoroughly understanding the fundamental principles of a particular technology and thereby appreciating that you could not possibly have any requirement for a given intermediate tool = informed judgement?

  • 07-16-2008 5:45 AM In reply to

    Re: That's what SMARTY were designed for...

    Locked Reply Contact

    From a quick once-over of smarty's feature lists it basically looks the only thing it has that PHP doesn't is less features.

    Which seems a weird thing for me to say is good, but I can see situations where it would be. Sure PHP is capable of anything Smarty is, but not vice versa. It's basically sandboxing the display layer away from the business logic layer (At least partially, I'm sure if you really tried you could bastardize smarty too, but not as bad as is possible in PHP). So for a development crew who follow best practices the sites would be almost identical. PHP doesn't have built-in sandboxing though to the best of my knowledge, though it might.

    There's many times where I've wanted to insulate my code better from designers than regular approaches allow. I mean sure, you've been great with seperating your logic from display, but along comes the designer who just read his PHP for Beginners book and thinks he knows everything and decides he can implement this new thing he wants without talking to you and put code to dump the contents of a file as HTML into your display layer... (That said, I wouldn't feel safe not reviewing changes from a designer who'd do that before they went live, smarty or not)

    That said, I'd personally still choose PHP and simply review templates for 99% of purposes, but I can feasably see that 1% of times where that feature might be good. Even then, I'd need more research before I'd say smarty's the best choice (Having never used it myself :P)

    Disclaimer 1: I have not coded anything beyond personal interest pages in PHP, most my webpage experience is ASP or .NET based. I'm not claiming to be an expert on PHP.

    Disclaimer 2: This isn't an agreement with DOA, and I kinda don't want to post this because it might be interpretted as agreeing with him. There's a big difference between weighing pros/cons of a system and going "Zomg it's great! Anyone not using it must be stupid. Why? Cause it's awesome" :P

  • 07-16-2008 6:18 AM In reply to

    • Daid
    • Top 100 Contributor
    • Joined on 01-30-2007
    • Posts 258

    Re: That's what SMARTY were designed for...

    Locked Reply Contact
    fyjham:

    Which seems a weird thing for me to say is good, but I can see situations where it would be. Sure PHP is capable of anything Smarty is, but not vice versa. It's basically sandboxing the display layer away from the business logic layer (At least partially, I'm sure if you really tried you could bastardize smarty too, but not as bad as is possible in PHP). So for a development crew who follow best practices the sites would be almost identical. PHP doesn't have built-in sandboxing though to the best of my knowledge, though it might.

    And then they added:
    http://www.smarty.net/manual/en/language.function.php.php

    I've used Smarty. It works quite well. It can be useful if you have a HTML monkey that can write and view HTML, but does not understand PHP. Then he can view his pages 'offline' and the smarty tags just show up as text. It also forces you to use default constructs (unless you use the {php} tag) which improves the overall style of the code.

    Then again, my current php pages are a mess of php parts embedded in HTML, cause that's much easier to write for myself. Just don't hand it to anyone else for maintenance.
  • 07-16-2008 6:19 AM In reply to

    • DOA
    • Top 75 Contributor
    • Joined on 06-26-2007
    • Posts 292

    Re: That's what SMARTY were designed for...

    Locked Reply Contact

     

    Zagyg:

    DOA:

    Arguing about a technology you have zero hands-on experience on = talking out of your rear

    But surely also: Thoroughly understanding the fundamental principles of a particular technology and thereby appreciating that you could not possibly have any requirement for a given intermediate tool = informed judgement?

    Fair enough. Nothing wrong with informed judgement. We certainly can't have hands-on experience with every technology out there. And not everyone needs a template engine.

    It's just that, unlike certain people here, when my expertise on a subject amounts only to an informed opinion, I'm not arrogant enough to get into a flamewar with people that have actual experience on the subject.

  • 07-16-2008 8:43 AM In reply to

    Re: That's what SMARTY were designed for...

    Locked Reply Contact

    At a company I used to work for it was decided to write an admin screen to let admins modify their templates through the web. The big benefit of Smarty in this case was the additional security of knowing admins couldn't execute any arbitrary PHP code. So if an admin password got out the person couldn't drop a little back door in the bottom of some template file that would go unnoticed. The only time this is a real benefit is when the application in question is designed with the knowledge that people with little to no programming experience will be making design changes to templates. Smarty still does not, however, have any good arguable use in applications designed to be used by people with programming knowledge.

  • 07-16-2008 8:53 AM In reply to

    Re: That's what SMARTY were designed for...

    Locked Reply Contact

    DrJokepu:

    DOA:

    Maybe he means graphics designers? In my personal experience the vast majority of their expertise lies in using Dreamweaver and the like. Asking them to add their HTML to the PHP framework is usually like giving a 7 year old gunpowder and telling him to build his own fireworks. Even if he can figure it out, it will most likely end in tears.

    Unfortunately I have yet to meet a graphics designer that's interested in learning to use a template system, Smarty or otherwise. Their philosophy is usually "If I can't drag-n-drop, I aint using it".

    The one who should be electroshocked here is the person who asks a graphic designer to do any development at all. They are graphic designers. Not developers. A graphic designer -by definition- cannot do development, and a software developer cannot do graphic design. That's the whole point of specialization. It is just unfair to expect people to do stuff they are not trained to or don't have the affinity to do. Personally, I never will be able to sell cars, neither to catch criminals, nor to design graphics. That's because software development is my profession and I suck at everything else, including Photoshop, Dreamweaver and the rest.

    To be honest, I am sick of the arrogant elitist mentality of "everybody else is stupid" in the IT/Software Development Industry. It is really unprofessional and should be grown out already.

     

     You're just reiterating the quote, though. Graphic designers shouldn't develop; that's what template engines are for.

     However, if a graphic designer is also a web designer, he has to be proficient with template systems, HTML and CSS. If he isn't, he should crank out a prototype in a graphical program like Photoshop and leave it for someone else to implement. Drag&Drop-generated templates are usually an abomination just as drag&drop-generated programs are.

    A monk asked Joshu: isTrue(dog.hasBuddhaNature()) ?
    Joshu replied: FILENOTFOUND
  • 07-16-2008 9:40 AM In reply to

    Re: That's what SMARTY were designed for...

    Locked Reply Contact

    DOA:
    And not everyone needs a template engine.

    PHP HAS A TEMPLATING ENGINE BUILT IN.  PHP HAS A TEMPLATING ENGINE BUILT IN.  PHP HAS A TEMPLATING ENGINE BUILT IN.

     

    DOA:
    It's just that, unlike certain people here, when my expertise on a subject amounts only to an informed opinion, I'm not arrogant enough to get into a flamewar with people that have actual experience on the subject.

    Believe me, I have far more experience building web apps than you do.  I know all about templating engines, PHP and Smarty.  Just because I don't use Smarty you assume I don't know anything about it.  I don't use it because I know a lot about it and can see it is nothing but a useless layer atop PHP.

    Tired of incompetent moderation?
    Wondering where all the clever discussion went?
    Try irc.slashnet.org #TDWTFMafia.
    We don't ban or kick and everyone is welcome.*

    *Stupid people will be mocked mercilessly and encouraged to commit suicide, however.
  • 07-16-2008 10:13 AM In reply to

    • DOA
    • Top 75 Contributor
    • Joined on 06-26-2007
    • Posts 292

    Re: That's what SMARTY were designed for...

    Locked Reply Contact

    morbiuswilters:
    DOA:
    And not everyone needs a template engine.
    PHP HAS A TEMPLATING ENGINE BUILT IN.  PHP HAS A TEMPLATING ENGINE BUILT IN.  PHP HAS A TEMPLATING ENGINE BUILT IN.
    So you keep telling us. Yet <php code><html><php code> and Smarty templates are two completely different things.
     

    morbiuswilters:
    DOA:
    It's just that, unlike certain people here, when my expertise on a subject amounts only to an informed opinion, I'm not arrogant enough to get into a flamewar with people that have actual experience on the subject.
    Believe me, I have far more experience building web apps than you do.  I know all about templating engines, PHP and Smarty.  Just because I don't use Smarty you assume I don't know anything about it.  I don't use it because I know a lot about it and can see it is nothing but a useless layer atop PHP.
    Maybe you're the one making false assumptions? How exactly can you compare experiences when you don't know the first thing about mine? Not to mention my initial point is still stands:

    Arguing about a technology you have zero hands-on experience on = talking out of your rear.

     

  • 07-16-2008 10:19 AM In reply to

    Re: That's what SMARTY were designed for...

    Locked Reply Contact

    DOA:
    So you keep telling us. Yet <php code><html><php code> and Smarty templates are two completely different things.

    "Completely different things"???  You are so full of shit.  They are different by a few characters, for fuck's sake.

     

    DOA:
    Arguing about a technology you have zero hands-on experience on = talking out of your rear.

    I am inclined to conclude that you are actually illiterate and just reply with random gibberish.  I have experience with Smarty from an analysis perspective.  I have rigorously investigated various frameworks and templating systems that were presented to me.  I know what I am talking about.  You have yet to provide a single reason to use Smarty instead of PHP.  NOT ONE SINGLE FUCKING REASON.  If your next reply does not contain a bullet list of reasons to prefer Smarty over PHP I will consider this argument over and myself the victor.  I hate to win by default but it's obvious you aren't even trying to debate this.

    Tired of incompetent moderation?
    Wondering where all the clever discussion went?
    Try irc.slashnet.org #TDWTFMafia.
    We don't ban or kick and everyone is welcome.*

    *Stupid people will be mocked mercilessly and encouraged to commit suicide, however.
  • 07-16-2008 10:36 AM In reply to