Ok today were going to be including the Smarty Template engine into our framework !


This will help you build your sites faster and make them more customizable and easy to change

With Smarty we can create fast and reliable php code from extremely small lines of code that are made to be easy and simple for end users !

Firstly lets grab the source code !

http://www.smarty.net/do_download.ph...-2.6.26.tar.gz

This file is Smarty 2.6.26 and is the latest stable release !

Ok so so lets take a look at the package !


Ok so as you can see theres a few files to help getting you started but for now were going to open the "libs" folder witch holds the code we need!


--

Now lets take a look at what we have in our framework package.


atm were in the directory system/engine/

Create a directory called template!


within that directory extract the contents WITHIN the libs directory and place them within the template directory within our framework !


Ok its not hard to implement the smarty engine into the registry as its object based like all our other items !

Ok so if we now go and open up startup.php and file the following line !

PHP Code: 
include SYSTEM_BASE_PATH '/engine/Database.php'
and add after!

PHP Code: 
include SYSTEM_BASE_PATH '/engine/template/Smarty.class.php'
then we add it to the registry !

so lets add Smarty to our registry engine!

Find:
PHP Code: 
Registry::set('Database',new Database()); 
Add After:
PHP Code: 
Registry::set('Smarty',new Smarty()); 
So now we should have something along the lines of !


Thants smarty engine setup and installed !

Next time were going to talk about the smarty configuration and how to set up caching and compile dirs ! also with recurse caching on php5

Next Time:
  • Configuring the Smarty Engine
  • Setting template directories
  • Creating our first template test !


Stay Tuned !
litewarez Reviewed by litewarez on . Tutorial [Creating a PHP Framework] {advanced} (PART 6) Smarty Engine Ok today were going to be including the Smarty Template engine into our framework ! http://www.imgcentre.com/img/uploads/big/2cea67a019.png This will help you build your sites faster and make them more customizable and easy to change With Smarty we can create fast and reliable php code from extremely small lines of code that are made to be easy and simple for end users ! Firstly lets grab the source code ! Rating: 5