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.php?download_file=Smarty-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 !
and add after!
then we add it to the registry !
so lets add Smarty to our registry engine!
Find:
Add After:
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:
Stay Tuned !
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.php?download_file=Smarty-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 !
[slide]http://www.imgcentre.com/img/uploads/big/072b091b90.png[/slide]
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!
[slide]http://www.imgcentre.com/img/uploads/big/43f474b991.png[/slide]
--
Now lets take a look at what we have in our framework package.
[slide]http://www.imgcentre.com/img/uploads/big/23efed055e.png[/slide]
atm were in the directory system/engine/
Create a directory called template!
[slide]http://www.imgcentre.com/img/uploads/big/7ee56e46f2.png[/slide]
within that directory extract the contents WITHIN the libs directory and place them within the template directory within our framework !
[slide]http://www.imgcentre.com/img/uploads/big/882603ddb9.png[/slide]
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:
include SYSTEM_BASE_PATH . '/engine/Database.php';
and add after!
PHP:
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:
Registry::set('Database',new Database());
Add After:
PHP:
Registry::set('Smarty',new Smarty());
So now we should have something along the lines of !
[slide]http://www.imgcentre.com/img/uploads/big/456b33139d.png[/slide]
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 !