Reply to Re: A couple questions about templating

Your name:

Reply:


Posted by Matthew Weier O'Phinney on 05/10/05 03:47

* James Williams <jamwil.php@gmail.com>:
> Hey fellas, sorry to infest the list with another question about a
> templating engine, but I am looking for some professional opinions
> here...
>
> I am trying to make a small, fast, and simple templating class... Now
> I have mastered the art of variable replacement, and have made two
> versions. The first one I made simply used file() to load up the file
> into an array, str_replace() to replace variables, then it printed it
> back. I made a second one, which reads the file into an array,
> changes the variables the same way, but instead compiles the finished
> product into a compile directory and then reads the compiled file back
> to the page. the benefit to this being that I can easily create a
> simple cache system now.
>
> 1st question) I need a professionaly opinion on to which solution is
> better, considering speed, security, and expandability.
>
> 2nd question) Like I said before, I've mastered the art of variable
> replacement, but how would one go about adding support for if {}
> statements as well as loops. I'm a little bit lost when it comes to
> this.

This has all been done before, and in a number of ways. If you really
*must* build your own templating class, go and thoroughly review the
code of those that already exist: Smarty, Savant, paTemplate,
FastTemplate, etc. Figure out how each solved the problems. Then
determine if you can improve upon their solutions.

--
Matthew Weier O'Phinney | WEBSITES:
Webmaster and IT Specialist | http://www.garden.org
National Gardening Association | http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org
mailto:matthew@garden.org | http://vermontbotanical.org

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация