Smarty

Soldato
Joined
8 Oct 2005
Posts
4,184
Location
Midlands, UK
Hi,

I've just been going through a ecommerce book that uses smarty. It uses a custom smarty plugin called 'load presentation object' to autoload a certain method of class files. Basically, you end up with an entire ecommerce store that uses only index.php. I personally found this to be a little overly complicated (when in reality its a big switch statement, including different templates and data.

I've seen a few smarty websites and like normal sites, use multiple files. E.g a product.php files that includes all the smarty stuff, passes product information to a product detail template file and displays it. This method personally makes more sense to me.

Assume the project is an ecommerce store.

Is there an actual correct way to use smarty in real world projects?

Thanks
 
This is actually nothing to do with smarty but a framework. Smarty just created the templates on the from the php (which was making everything a switch statment). There is no best way but using a framework (as described in your book) is often the method of choice for creating large scale projects. If you have a look at the magento source code and you will see that they use the Zend framework (Magento is an open source E-Commerce solution). But however you choose to write it wont be a problem.
 
Back
Top Bottom