Web Design Methods - Using Templates?
Hello, I understand that it is a good idea to separate 'layout' 'content' and 'logic' when building web applications. It seems a template system is ideal for seperating the layout. I want a graphic designer to design the page layout without needing PHP to build the page. However, in the Smarty templates I have looked at, there seems to be a lot of Logic! (Isn't this just shifting the problem?) Essentially, is there a way to edit a simple html file for layout, while keeping content and logic separate?
Public Comments
- I'm not sure where you're seeing this "logic" - are there some browser compatibility workarounds using JavaScript? A relatively simple website should be implementable using nothing more than XHTML and CSS. Try to stay standards compliant and you should be able to do it w/o JavaScript, and certainly w/o PHP.
- This separation you mention is covered in the MVC (Model View Controller) design pattern. It isn't so much of separating logic, but "business logic". Presentation logic will always be part of the "View" or "Layout", either directly or through templates. For most web sites, there isn't a lot of business logic (or the controller part). There is however plenty of presentation logic. For smarter sites nowadays, you get some implemented in Javascript, and some in a server side language. If you want your layout to be done in static html, and still have dynamic content, you're limited to Javasctipt and AJAX. Not a good way to go about it. You can use PHP and still have everything separated. you just use "include" directive to include all yout logic and possibly content in your layout files. Look at Wordpress. The template system it uses is pretty simple. Your content stays in a database, you have templates, that set the layout, and can include logic from external files.
- Do you know what? I think the answer to your question is actually, "No". There isn't a really totally simple way to separate out the content, logic (as you call it) and data. Not simple in the sense that you don't need to know web programming pretty well to achieve it. Personally I would stay well away from Smarty. It works for some, but I tend to agree that the HTML coder still has to learn Smarty syntax which frankly isn't all that different from PHP. So yes, the problem is only shifted, and only made slightly less difficult. I tend also not to let a graphic designer design the page. Graphic desginers are brilliant at making things look beautiful, but that doesn't mean they know how to put a useable interface for a web page together. I have just started putting a new web site together, and I have used CodeIgniter as my MVC framework. Also, I did all the graphic design myself and I can't draw for a toffee. With the new web 2.0 look in fashion at the moment, fancy graphics are just not needed. You can do it all yourself - I did. Look at my site - it still being written, but the basic bones are there : look : http://www.seosquirrel.com
Powered by Yahoo! Answers