PHP/HTML Content Practices
Posted 12 September 2006 - 03:59 AM
What about file structure? Does everyone have a typical header/body/footer structure where they include/require header and footer files in every page and fill in the content in between?
Posted 12 September 2006 - 09:45 AM
Headers and footers are usually a good idea. But it depends a lot on your application. It might make sense to abstract other things out too. If you're using Smarty, you can have code in your "display a page" function that adds in the header and footer for every page. Then there's no need to repeat that code everywhere. If some pages don't use the standard header/footer, you can set a "don't load header/footer" variable before calling the display function.
The system I work on currently uses apache to rewrite requests like /page.html to use the script page.php and the Smarty template page.html, and call the function page() to get the Smarty variables. Then to make a new page you just create the template and the associated file, and off you go.
Smarty templates include foreach loops, captures (eg, capture your pagination links and print them at the top and bottom of the page with only one set of code, but all still in the templates), and other nifty stuff.
Posted 12 September 2006 - 09:55 AM
If there are web designers and web programmers things should be different. And none should do others job. But with smarty, a designer can write it's own logical queries, which I would never prefer.
I use pear's html_template_it which is quite good and only a template system. It's very easy to learn too.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users