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 1 of 2 (83 items) 1 2 Next >
Sort Posts: Previous Next
  • 07-14-2008 6:26 PM

    That's what SMARTY were designed for...

    Locked Reply Contact

    I've been recently fixing a cms written in PHP using SMARTY tpl's... well, it was one of the requirments to do so. I fixed few bugs, and started checking for optimization, and I've found that page template looks like these:

    {$page_text}

     The whole content was generated using PHP, and SMARTY... well, they wanted them, so here they are, with their whole functionality ;)

    Filed under:
  • 07-14-2008 6:38 PM In reply to

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

    Locked Reply Contact

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

    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-14-2008 9:31 PM In reply to

    • Weng
    • Top 500 Contributor
    • Joined on 03-15-2008
    • Posts 72

    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?  Fuck it.

     

     Because useless wanker web devs can't figure out how to not break PHP.

  • 07-15-2008 2:44 AM In reply to

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

    Locked Reply Contact

    Weng:

     Because useless wanker web devs can't figure out how to not break PHP.



    And how do you "break" PHP? If you acctually meant breaking the application then i'm afraid smarty isn't going to help you.

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

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

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

    Locked Reply Contact

    stratos:
    Weng:
     Because useless wanker web devs can't figure out how to not break PHP.
    And how do you "break" PHP? If you actually meant breaking the application then i'm afraid smarty isn't going to help you.
     

    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".

    As for the OP... I hope they don't ask you to update the HTML.

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

    • henke37
    • Top 500 Contributor
    • Joined on 05-22-2007
    • Sweden
    • Posts 98

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

    Locked Reply Contact
    My philosophy is "if you can't do html and css by hand, I am not working with you".
  • 07-15-2008 5:28 AM In reply to

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

    Locked Reply Contact

     Slightly side-tracking a bit, you just reminded me of the time I got called out- to remove a smarty from a USB socket. It's amazing what you find in there sometimes. I was so gobsmacked (This was an adult shop) that I took a picture- I'll have to go find it!

  • 07-15-2008 6:25 AM In reply to

    • DrJokepu
    • Top 500 Contributor
    • Joined on 03-20-2008
    • London, UK
    • Posts 96

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

    Locked Reply Contact

    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.

    The good doctor is here to help. I promise this time I will not screw up the operation.
  • 07-15-2008 7:32 AM In reply to

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

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

    Locked Reply Contact
    DrJokepu:
    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.
    Yeah. But the question then remains... I got these fancy graphics here, and this nicely stable website that works great. Who is going to put them in the same jar and stir till it's one?

    The "I do software development, nothing else" mentality is also stupid. Someone has to put it all together. I've been a solo coder in a UT2004 mod (as hobby project), and while we had a few graphic artists, some modelers and a few people that build maps. I was the one that had to put it all together, rescaling models, fixing animations, exporting files to the right formats, fixing up maps, and tieing it all together in a final installer. In the end I had a 3D Studio Max, Photoshop and UnrealEd open, next to my coding tools (a text editor). Unless someone is getting out of that little box, you'll never get anywhere. Of course I'll never become a real artist, but I surely know the tools of the rest of the team.
  • 07-15-2008 7:43 AM In reply to

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

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

    Locked Reply Contact

    DrJokepu:
    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.
    Sounds good in theory, but in a project where a developer builds the code and the graphics designer does the HTML/CSS someone had to do the integration at the end. And when the graphics change and the graphics designer produces a new batch of HTML/CSS someone has to do it all over again. In practice it's the developer that has to do this mind-numbing grunt work. Which is why people have come up with template systems like Smarty.  And let's face it, using the HTML side of Smarty is not exactly rocket science. We're not asking graphics designers to track down a memory leak here.

    Even if it were unfair to ask graphics designers to use a template system, it's definately not as unfair as having a developer do cut-and-paste HTML grunt work. I don't see why both parties can't agree to use a template system and meet in the middle. 

  • 07-15-2008 8:47 AM In reply to

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

    Locked Reply Contact
    Speaking of graphic designers, the one who works for my company had a real hard time learning PHP, and by learning, I mean learning about includes. She still often creates header.inc files (which can typically just be opened like text files across the web) and tons of other files. It's still an improvement when she first started working for me and was putting ASP in all of the files. I forgive all of this because she makes wonderful designs and templates.
  • 07-15-2008 9:21 AM In reply to

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

    Locked Reply Contact

    urmmm, like someone already said. smarty is a tempalte language, and HEY what do you know, PHP is also a template language.

    <? FOREACH ( $items as $item): ?>

    <? IF ($item['special'] == true): ?>  special <? ENDIF; ?>

    <? ENDFOREACH; ?>

    vs.

    {foreach from=$items item=item}

    {if ($item.special == true) }  special {/if}

    {/foreach}

     

    No really what a big difference.

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

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

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

    Locked Reply Contact

    stratos:
    urmmm, like someone already said. smarty is a tempalte language, and HEY what do you know, PHP is also a template language.
    I don't understand. Do we have something better than Smarty and like for the separation of PHP from HTML/CSS in a way that can be maintained without the developer having to muck about with HTML/CSS?

  • 07-15-2008 10:13 AM In reply to

    • DrJokepu
    • Top 500 Contributor
    • Joined on 03-20-2008
    • London, UK
    • Posts 96

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

    Locked Reply Contact

     Dear Sir,

    I have be the requirement to write a Web 2.0 website in AJAX, SMARTY, PHP and CSV. SNARTY  says

    Smarty error: problem creating directory "templates_c/239/239105369"

    Smarty error: problem creating directory "templates_c/239/239105369"

    Smarty error: problem creating directory "templates_c/239/239105369"

    Could you tell me what the problem is? Please send me your code to hkhan@yahoo.co.in

    The good doctor is here to help. I promise this time I will not screw up the operation.
  • 07-15-2008 10:29 AM In reply to

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

    Locked Reply Contact

    DOA:
    I don't understand. Do we have something better than Smarty and like for the separation of PHP from HTML/CSS in a way that can be maintained without the developer having to muck about with HTML/CSS?

    Just use PHP.  Seriously, Smarty is just a slightly modified and weaker PHP syntax.  Your templates should mostly be HTML, CSS and JS anyway, with some variables pulled in and maybe a little bit of conditional logic or looping.  This is what Smarty does.  This is also what PHP does.  Why would you install a separate application to essentially emulate PHP-lite on top of 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-15-2008 10:54 AM In reply to

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

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

    Locked Reply Contact

     

    morbiuswilters:
    Just use PHP.  Seriously, Smarty is just a slightly modified and weaker PHP syntax.  Your templates should mostly be HTML, CSS and JS anyway, with some variables pulled in and maybe a little bit of conditional logic or looping.  This is what Smarty does.  This is also what PHP does.  Why would you install a separate application to essentially emulate PHP-lite on top of PHP?
    Ah, I see. Well, assuming we have a graphics designer that would add his own stuff, I'd have to go with a template system because of the greater separation of presentation from code. Template systems tend to keep presentation in separate files which is good for graphics designers whose eyes understandably glaze over when confronted with the usual spaghetti of code and presentation you'd find a single PHP file (we're talking heavy-duty admin pages and the like here). Not only that but the more you have to deal with internationalization the more handy a template system becomes.

    That said, if I could find a graphics designer that's unfazed by the prospect of manouvering through code to make his changes (and can do so without messing up the code) I'd be more than happy to forego the template system and let him have a go at the .php files.

  • 07-15-2008 11:31 AM In reply to

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

    Locked Reply Contact

     Ummm, so you need a third party application to put your presentation code into another file?

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

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

    Locked Reply Contact

    DOA:

    Ah, I see. Well, assuming we have a graphics designer that would add his own stuff, I'd have to go with a template system because of the greater separation of presentation from code. Template systems tend to keep presentation in separate files which is good for graphics designers whose eyes understandably glaze over when confronted with the usual spaghetti of code and presentation you'd find a single PHP file (we're talking heavy-duty admin pages and the like here). Not only that but the more you have to deal with internationalization the more handy a template system becomes.

    That said, if I could find a graphics designer that's unfazed by the prospect of manouvering through code to make his changes (and can do so without messing up the code) I'd be more than happy to forego the template system and let him have a go at the .php files.

    Seriously, what the hell are you talking about?  PHP is a templating language, in addition to many other things.  If your pages are spaghetti logic all crammed into one file, that is your fault.  Ideally you would have PHP template files with well-constructed business objects kept completely separate.  There is no need for Smarty to accomplish 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-15-2008 1:13 PM In reply to

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

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

    Locked Reply Contact

    morbiuswilters:
    Ideally you would have PHP template files with well-constructed business objects kept completely separate. There is no need for Smarty to accomplish this.
    If like you said I'm going to have a separation of logic and presentation then someone has to build that architecture. Why would I opt for the not-invented-here option by building my own when an existing template system like Smarty can do it for me?

  • 07-15-2008 1:20 PM In reply to

    • DrJokepu
    • Top 500 Contributor
    • Joined on 03-20-2008
    • London, UK
    • Posts 96

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

    Locked Reply Contact

    DOA:
    Why would I opt for the not-invented-here option by building my own when an existing template system like Smarty can do it for me?

    Why would I opt for the not-invented-here option by building my own when an existing template system like PHP can do it for me?

    The good doctor is here to help. I promise this time I will not screw up the operation.
    Filed under:
  • 07-15-2008 1:24 PM In reply to

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

    Locked Reply Contact
    DOA:
    If like you said I'm going to have a separation of logic and presentation then someone has to build that architecture.
    Right, the PHP developers.
    DOA:
    Why would I opt for the not-invented-here option by building my own when an existing template system like Smarty can do it for me?
    WTF? Do you think Smarty is going to write your web app for you?
  • 07-15-2008 1:30 PM In reply to

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

    Locked Reply Contact

    DOA:

    morbiuswilters:
    Ideally you would have PHP template files with well-constructed business objects kept completely separate. There is no need for Smarty to accomplish this.
    If like you said I'm going to have a separation of logic and presentation then someone has to build that architecture. Why would I opt for the not-invented-here option by building my own when an existing template system like Smarty can do it for me?

     

    If you want a framework, use a framework. There are plenty to choose from. Some use smarty, some don't. 

    But using smarty because its "easier for designers" is just bullshit.
    "Show me a sane man and I will cure him for you." - C. G. Jung
  • 07-15-2008 1:42 PM In reply to

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

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

    Locked Reply Contact

    bstorer:
    DOA:
    If like you said I'm going to have a separation of logic and presentation then someone has to build that architecture.
    Right, the PHP developers.
    Only a complete novice would write from scratch something he can get from a proven existing library. Try and educate yourself on good programming practices.
    bstorer:
    DOA:
    Why would I opt for the not-invented-here option by building my own when an existing template system like Smarty can do it for me?
    WTF? Do you think Smarty is going to write your web app for you?
    Are you on drugs? Which part of using Smarty for a webpage's templating needs didn't you understand?

    stratos:
    But using smarty because its "easier for designers" is just bullshit.
    It's easy to brand someone's suggestion as "bullshit" without offering an alternative. How do you think it should be done to be easier for designers?

  • 07-15-2008 1:48 PM In reply to

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

    Locked Reply Contact

    DOA:
    stratos:
    But using smarty because its "easier for designers" is just bullshit.
    It's easy to brand someone's suggestion as "bullshit" without offering an alternative. How do you think it should be done to be easier for designers?
     

    stratos:

    urmmm, like someone already said. smarty is a template language, and HEY what do you know, PHP is also a template language.

    <? FOREACH ( $items as $item): ?>

    <? IF ($item['special'] == true): ?>  special <? ENDIF; ?>

    <? ENDFOREACH; ?>

    vs.

    {foreach from=$items item=item}

    {if ($item.special == true) }  special {/if}

    {/foreach}

     

    No really what a big difference.


     

    "Show me a sane man and I will cure him for you." - C. G. Jung
    Filed under: