I use a template engine called "outline" for a web project. Outline has two ways of setting up templates. The first way: require "config.php"; $outline = new Outline('templatename'); require $outline->get(); PHP: In this case, all the variables of the php file will be available in the template 'templatename'. The second way is the traditional way of templating: require_once "config.php"; require_once OUTLINE_CLASS_PATH."/tpl.php"; $test = new OutlineTpl('products'); $test->assign('title', 'Fancy Dandy Product'); $test->display(); PHP: I am used to this second version, as it is similar to smarty. Variables need to be assigned to the template before they can be used in the output. Which way of templating would you suggest to use for a production website? The second version seems more secure to me, whereas the first version would make the code more clean and maintainable (because there is no need to assign variables to a template before using them).
Disclaimer: I've never heard of Outline before, so I'm just basing what I say from how I feel it should be done. The first one has less lines, but you're not able (I believe) to assign the variables dynamically in the PHP code itself (The page that you're running this code on). The second way allows for you to dynamically assign those variables. The disadvantage that I see is it would be slower than the first one because it requires you having to set the OutlineTpl instance, then add a variable, and output it. Overall, I don't see any real issue in security for picking one over the other, but if you want speed, I'd personally go with the first one. If I wanted to assign something via my PHP code, I'd go with the second one.
I would choose the second method every time to be honest. I'm a smarty fan and believe in the concept of keeping view and processing separate. Using the first method just eliminates that and allows anything to be in the template, which could have major implications should there be a design and a development team working on each section individually, and the design team use vars they shouldn't
I agree with JAY6390 and would recommend 2nd method only. I have been through tough times separating out view from logic in past and hence whenever I use templates, I assure to have a method like Smarty to keep them separate.
no body hearing about this new templete engine but i know all templetes engine why becuase thay store here and there is many you can get any other one
Another shameless plug. He already has the Templating engine so why would he need it again? Also if you're going to link it link to the proper page http://code.google.com/p/php-outline/
hey every one I want to delete select rows from the table using php.Same way what we do in hotmail or gmail. thanx