I am about to inherit two PHP/MySQL sites from another developer through the graphic designer who contracts the jobs. Both sites are done using Smarty Template engine and I have no experience with it.

Looks to me like there are these .tpl files for each php file and a global header and footer .tpl file. It looks like is is just doing a replaces on particular element "markers" in the templates from the PHP file.

My questions are:

  1. How hard is it to manage these sites and make additions to?
  2. How can I allow the designer to make changes to the .tpl files himself in a WYSIWYG editor (like Dreamweaver in design mode.)

His main complaint (the graphic designer) is he hasn't been able to do that because the .tpl files are in and of themselves incomplete HTML with a </tr> ending on the header.tpl file and an <tr> continuing on the next file say index.tpl so I think Dreamweaver won't display incomplete HTML tables. What good is a "templating" system if my designer can't easily make changes? Isn't that one of the big reasons for separating the template from the PHP code? Did this original programmer just chop up the template stupid or is that how Smarty does it?

    marms wrote:

    1. How hard is it to manage these sites and make additions to?

    Design wise, smarty is great. If the programmer did his job, smarty should completely sperate the logic of the code from the HTML.

    2. How can I allow the designer to make changes to the .tpl files himself in a WYSIWYG editor (like Dreamweaver in design mode.)

    His main complaint (the graphic designer) is he hasn't been able to do that because the .tpl files are in and of themselves incomplete HTML with a </tr> ending on the header.tpl file and an <tr> continuing on the next file say index.tpl so I think Dreamweaver won't display incomplete HTML tables. What good is a "templating" system if my designer can't easily make changes? Isn't that one of the big reasons for separating the template from the PHP code? Did this original programmer just chop up the template stupid or is that how Smarty does it?

    This is probably something the original programmer did. Basically, he seperated the file into chunks so he could reuse the header/footer code, I'm guessing. If you're redesigning, redesign it from scratch and split up the new design into the header/footer/content...If you want to make edits to the header and footer (and not -just- the content), you'll have to patch them together into one file and edit them that way.

      marms wrote:

      1. How hard is it to manage these sites and make additions to?

      Very easy. Smarty is a good templating system.

      2. How can I allow the designer to make changes to the .tpl files himself in a WYSIWYG editor (like Dreamweaver in design mode.)

      Clearly both you and the designer will need your own development copy of the system. Moreover, you'll both need servers that work (Of course you could use different instances on the same server).

      You'll need some source code version management system to merge your changes and/or prevent problems when you're both accessing the same files.

      His main complaint (the graphic designer) is he hasn't been able to do that because the .tpl files are in and of themselves incomplete HTML with a </tr> ending on the header.tpl file and an <tr> continuing on the next file say index.tpl so I think Dreamweaver won't display incomplete HTML tables.

      Yes, this is an issue I'm afraid. None of our Smarty templates use tables for presentation, so I can't help you there.

      Your best bet, long-term, would be to stop using tables for presentation. Then you won't need to start a new row in an existing table for your Smarty template parts.

      Of course, this may be contrary to how your designer has been trained, but it's the modern way. Get used to it.

      Dreamweaver et al. do not lend themselves to this modern approach - because DW isn't going to know about your style sheet (in which most of the style will be stored) - therefore it will show everything up all wrong in the page.

      Another possibility is to get a Smarty-aware version of Dreamweaver. I do not know if such things exist.

      What good is a "templating" system if my designer can't easily make changes?

      Trust me, they can. You're just using a poor HTML design.

      Maybe a Smarty-aware version of DW is around, or some kind of plugin that allows DW to see Smarty includes.

      Isn't that one of the big reasons for separating the template from the PHP code?

      It's not as simple as that.

      Even with the best will in the world, the designer will need to change the PHP code, and the programmer will need to change the template. These are facts of life.

      Get yourself a proper source code version management system, or you'll be in big trouble!

      Mark

        Write a Reply...