From: Waitman C. G. <wa...@em...> - 2002-11-17 19:34:40
|
Hello What I typically do is get rid of all "echo" and "print" commands from the scripts, have all content producing code stuff in a string, like $content. I load an html layout or template into $layout. This html template has HTML comments in it, such as <!--Content--> and, optional other ones such as <!--Date-->, <!--Username-->, etc. With the layout in a single file, this makes editing the layout in something like Dreamweaver a piece of cake. In my script, i simply do an $layout = @join(@file('layout.html')); $html = ereg_replace("<!--Content-->",$content,$layout); echo $html; I have used this method on about 120 web sites, it works very well and is easy to make site-wide updates. Additionally, it makes it easy to change the content type, or send a different layout to different browsers. (just load a different file into $layout); If you only have one script that does the echo $html thing, it makes life extremely easy when managing cookies, user authentication, etc. Additionally, you can use the mod_rewrite engine with apache to create an instant dynamic site. Redirecting all requests to your index.php, which reads the original requested URI and returns the appropriate content. It can "include" content producing code on demand. I have used the rewrite method on about 50 web sites, and it seems to work very swell. Take care, Waitman Gobble EMK Design Buena Park, California +1.7145222528 http://emkdesign.com On Sun, 2002-11-17 at 10:30, Ed wrote: I'd like to try working a template system into PHP ICalendar, in order to improve separation of presentation and logic. There are several options available, and I'd like to get some opinions on what folks think would be a good choice. Here are the criteria that I had in mind (feel free to add your own, of course): 1) Easy to integrate; preferably contained in a single file 2) Doesn't require that the file system be writable by the web server's user (typically necessary for caching, so caching should at least be disable-able) 3) supports some basic "if" and loop constructs, but should not be overly complex. I have already semi-ruled out Smarty, because I think the complexity, while powerful, is overkill. I could be convinced otherwise, though. 8) I tried doing some work with the PHPLIB template class. I think that the lack of proper "if" constructs made it tedious to try and integrate into the app as-is. I also have a very simple homegrown template system that just uses standard PHP for logic. That would avoid having to learn a new syntax for the templates, but it might also tempt people to do more complex stuff than they should in the templates. Thoughts? -- "it's like an addiction to idiocy" -j -Ed ------------------------------------------------------- This sf.net email is sponsored by: To learn the basics of securing your web site with SSL, click here to get a FREE TRIAL of a Thawte Server Certificate: http://www.gothawte.com/rd524.html _______________________________________________ Phpicalendar-devel mailing list Php...@li... https://lists.sourceforge.net/lists/listinfo/phpicalendar-devel |