Hello, I am working together w/ a web designer in creating a content management site. I am doing all the programming in php and the designer will be responsible for the html, css and art. The problem is my web designer does not know how to code in php. Therefore, I need a workflow that separates php code from html layout and allows us to work on the site separately. Is a template engine the solution? I have some experience w/ the Smarty Engine. With Smarty, this separation appears to be possible, although the designer would still need to learn some basic Smarty syntax. However would using a template engine be overkill for my purposes? Is there a better solution than resorting to a template engine? I'm curious as to how most web development teams tackle this problem. Or is it the case today that a web designer must be knowledgeable in an internet scripting language such as php, javascript, etc... Thank you
I love Smarty, but I don't see why the designer needs to learn the syntax. Can't he design it, give it to you and you put the Smarty code in? Either way, you can't go wrong with Smarty. You're gonna regret not using it when it comes to the point where you want to change the layout. (At least if you have a lot of pages)
You can't get around the fact that at some point your logic has to mix with presentation. How you want to do it is entirely up to you - personally I can't be bothered with Smarty. A template engine usually supports text replacements, variables, functions, conditionals, loops, file inclusion etc. But you can already do all that in PHP - all Smarty does is give you a different syntax to learn with much less flexibility. If you're using it because you want your designer to be able to integrate the HTML, he'll have to learn the Smarty syntax. If he has to learn anything, why not make it something useful and use PHP? I'm sure Smarty does have it's uses, I've just never needed it myself.
Smarty is not overkill for most designers, in fact I'm contemplating using XSLT for distributed scripts for its many advantages and hoping that there are enough designers who know some XSLT. Alternatively, they can provide HTML templates that I use to make the XSLT myself, along the lines of what "nico_swd" said. Content management systems are often large enough to benefit from a template system and Smarty is fairly easy to use for both developer and designer, I'd go with it.
I totally disagree with this statement. If you write your code with proper includes, you don't need a templating engine. I write sites constantly that I can easily swap out layouts with little to no work, and in fact I find it way more difficult to update sites that use Smarty because the templates are usually spread out and aggravating. In most cases it's just overkill. If you're that concerned make sure that css styles are used well and just toss in a few includes and you should be set.