您的位置:首页 > 编程语言 > PHP开发

Integrating Smarty with the Zend Framework

2007-08-12 23:44 579 查看
Inspired by this article I started to play around a bit to integrate the Smarty template engine into the Zend Framework. My ambition was to minimize the required code in the controller actions but stay close to the given Zend_View API. I also wanted to integrate the Smarty caching feature. Here is the code I came up with.

Class location

The class file is named by my company (Travello) and is placed in the Travello directory beneath the Zend Framework library include path. Its advantage is that the class will be auto loaded in my setup.



  /Zend


    /View


  /Travello


    /View


      Smarty.php



Class definition and constructor

Let's start with the class definition and the constructor part. My class Travello_View_Smarty is extending the Zend_View_Abstract class. In the constructor the parent constructor from Zend_View_Abstract is called first. After that a Smarty object is instantiated, configured and stored in a private attribute.

Please note that I use a configuration object from the object store to get the configuration data for Smarty.



class Travello_View_Smarty extends Zend_View_Abstract


{


    private URL:http://devzone.zend.com/node/view/id/120
Inspired by this article I started to play around a bit to integrate the Smarty template engine into the Zend Framework. My ambition was to minimize the required code in the controller actions but stay close to the given Zend_View API. I also wanted to integrate the Smarty caching feature. Here is the code I came up with.

Class location

The class file is named by my company (Travello) and is placed in the Travello directory beneath the Zend Framework library include path. Its advantage is that the class will be auto loaded in my setup.

  /Zend


    /View


  /Travello


    /View


      Smarty.php



Class definition and constructor

Let's start with the class definition and the constructor part. My class Travello_View_Smarty is extending the Zend_View_Abstract class. In the constructor the parent constructor from Zend_View_Abstract is called first. After that a Smarty object is instantiated, configured and stored in a private attribute.

Please note that I use a configuration object from the object store to get the configuration data for Smarty.

___FCKpd___1

Implement _run() method

The method _run() is the only method that needs to be implemented in any subclass of Zend_View_Abstract. It is called automatically within the render() method. My implementation just uses the display() method from Smarty to generate and output the template.



protected function _run($template)


    {


        $this->_smarty->display($template);


    }



Overwrite assign() method

The next part is an overwrite of the assign() method from Zend_View_Abstract, which works in a similar way. The big difference is that the values are assigned to the Smarty object and not to the $this->_vars variables array of Zend_View_Abstract.



public function assign($var)


    {


        if (is_string($var))


        {


            $value = @func_get_arg(1);


            


            $this->_smarty->assign($var, $value);


        }


        elseif (is_array($var))


        {


            foreach ($var as $key => $value)


            {


                $this->_smarty->assign($key, $value);


            }


        }


        else


        {


            throw new Zend_View_Exception('assign() expects a string or array, got '.gettype($var));


        }


    }



Overwrite escape() method

The next part is an overwrite of the escape() method from Zend_View_Abstract. It works both for string and array values and also uses the escape() method from the Zend_View_Abstract. The advantage of this is that I don't have to care about each value of an array to get properly escaped.



public function escape($var)


    {


        if (is_string($var))


        {


            return parent::escape($var);


        }


        elseif (is_array($var))


        {


            foreach ($var as $key => $val)


            {


                $var[$key] = $this->escape($val);


            }




            return $var;


        }


        else


        {


            return $var;


        }


    }



Print the output

The next method output() is a wrapper on the render() method from Zend_View_Abstract. It just sets some headers before printing the output.



public function output($name)


    {


        header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");


        header("Cache-Control: no-cache");


        header("Pragma: no-cache");


        header("Cache-Control: post-check=0, pre-check=0", FALSE);




        print parent::render($name);


    }



Use Smarty caching

The last two methods were created to simply integrate the Smarty caching mechanism in the View class. With the first one you can check for cached template and with the second one you can set the caching on or of.



public function isCached($template)


    {


        if ($this->_smarty->is_cached($template))


        {


            return true;


        }


        


        return false;


    }




    public function setCaching($caching)


    {


        $this->_smarty->caching = $caching;


    }


}//END CLASS



That was the complete code of my Travello_View_Smarty class.

How to use the class

The usage of this class is quite simple. In your bootstrap file you can initialize it like this. The $viewConfig is used to setup the Zend_View paths. After creation the object is registered in the object store for later usage.



$viewConfig = array();


$viewConfig['scriptPath'] = $config->getSetting('framework', 'view_dir');




$view = new Travello_View_Smarty($viewConfig);


Zend::register('view', $view);



Within your controller an action method could look like this.



public function indexAction()


    {


        $temp_file = 'homepage.htm';


        


        $view = Zend::registry('view');


        


        if (false === $view->isCached($temp_file))


        {


            $vars = array();


            $vars['title'  ] = 'Page <title>';


            $vars['text'   ] = 'A text is a text & a text is a text.';


            $vars['numbers'][0] = 12.9;


            $vars['numbers'][1] = 29;


            $vars['numbers'][2] = 78;


            


            $vars = $view->escape($vars);


            


            $view->assign($vars);


        }


        


        $view->output($temp_file);


    }



Conclusion

That was basically it. I have a couple of ideas how to extend this solution, but it already does the work for me. Any comments are welcome.

Updated on April 18, 2006

Please have also a look at the follow-up article on Integrating Sarty and ez Components with the Zend Framework.

Digg This!

Comments

Add Comment

Tuesday, April 4, 2006

RELATED ARTICLE ON SMARTY CACHING

1:59PM PDT · Jayson Minard (editor)

PHPDeveloper.org just pointed out a related article on caching using Smarty. This will fit nicely with what Ralf has written here.

Wednesday, April 5, 2006

CONFIG CLASS

2:24AM PDT · jmkeith
Are you using some sort of Config class to handle the getSetting() method, etc?

CONFIG CLASS

3:03AM PDT · Ralf Eggert
Hi,

currently I am using the ezcConfiguration and ezcConfigurationIniReader from the ezComponents http://ez.no/doc/components/view/latest/(file)/introduction_Configuration.html
To integrate the ezComponents within the Zend Framework I put the ezComponents directory in my include_path and use a slightly different __autoload() function:


<pre>


include_once 'Zend.php';


include_once 'Base/src/base.php';




function __autoload($class)


{


if ('ezc' == substr($class, 0, 3))


{


ezcBase::autoload($class);


}


else


{


Zend::loadClass($class);


}


}


</pre>

To use the Configuration component I set it up and store the configuration object in the object store of the Zend Framework.


<pre>


$reader = new ezcConfigurationIniReader();


$reader->init('path/to/your/ini/files', 'settings.ini');


$config = $reader->load();


Zend::register('config', $config);


</pre>

That is basically it.

HTH, Ralf

GRMBL

3:05AM PDT · Ralf Eggert
The HTML markup doesn't seem to work in the comments. But hopefully you get the point.

SMARTY DESING AND INTERNATIONALIZATION

5:53AM PDT · hzubieta
It sounds good!!; the integration with Smarty is saving-time idea. I had used in my own Application Framework for while, it had save me a lot of time, I used in conjunction with Dreamweaver and the software interface is complete independent from the application coding: Zend Studio for Coding and Dreamweaver to designing.

If you redefined the Smarty Tags to "<?" and "?>" and uses Templates it allows you to see a really clean design in your design editor (there are other ways to do that, but this is quick!!). Templates also make it easy to develop huge interface changes in all your application on the fly without touching your code (the customers like that!!!) and taking advantage of the smarty cache management.

Another thing that helped me was the idea of Tom Anderson of adding a "T" block for Internationalization support. With this you, can even make your design in English and tagged all translatable text with "T" blocks and after use a Smarty-T- block plugin to support your application in different languages. I used in Japanese and I developed my own t block plug in like this:


function smarty_block_t($params, $content, &$this)


{


if (!$content) 


return $content;


return i18ngettext(trim($content));


}

The i18ngettext is a function that search into the localization files and returns the content with the translated phrase if it exists. I rewrite the i18ngettext in order to cached the files.

In design time text will look like:

<?t?>Translate me<?/T?>

Bye,

Hermann

Sunday, April 9, 2006

SMARTY AND HELPERS

11:30AM PDT · octavian82
Nice work. I wonder if it is possible to make use of the Zend_View Helpers out of the templates? I didn't manage to get it working.
For example if you created a Zend_View_Helper_MakeUrl and want to invoke it through a template:

<a href="{makeUrl('index','login')}">Login</a>

I don't think it is possible by using your approach because the helper method are unknown to the smarty object.
In my code is assigned a Zend_View Object that includes all output variables to the smarty object by doing:


$view = new Zend_View();


$view->template = 'index.html';


//add other output variables in the actioncontroller


$smarty = new Smarty();


//smarty cfg stuff




//at the end of the script


$smarty->assign('view', $view);


$smarty->display($view->template);



By doing this, smarty will automatically invoke the Zend_View::__call() method to unknown funktions, and that invokes the helper methods. the disadvantage is that you have to use:

<a href="{$view->makeUrl('index','login')}">Login</a>

which is a little more code, but it works for me.

One more Question: Did anyone manage to make TemplateLite (former SmartyLite) working with ZF?

regards, Marc

RE: SMARTY DESING AND INTERNATIONALIZATION

9:27PM PDT · Ralf Eggert
Hi Hermann,

thanks for your comments on internationalization. Sounds very good to me. For myself, I haven't come to that part yet, but your approach sounds reasonable to me.

Until now what I did was to assign an array called "translate" to Smarty and to access the translation via {$template.to_be_translate}.

Best Regards,

Ralf

RE: SMARTY AND HELPERS

9:30PM PDT · Ralf Eggert
Hi Marc,

you could easily assign the View object to Smarty as well by doing something like this in the _run() method:


protected function _run($template)


{


$this->_smarty->assign('view', $this);


$this->_smarty->display($template);


}



But I haven't tested this yet, so I might be wrong.

Best Regards,

Ralf

Monday, May 29, 2006

GREAT TUTORIAL

4:12AM PDT · tlmarker
Ralf,
I just wanted to drop a comment to tell you how much I appreciate this tutorial. I was in the process of starting a new project, and wanted to use a more stuctured approach. I was all ready using smarty without the Zend framework.
I knew I wanted to use the framework in my new project, but also wanted to use smarty. Your tutorial was the deciding factor in my changing to the Zend Framework. After spending most of yesterday downloading, and installing Apache I was able to get it working. (After spending a few hours learning how th configure Apache. Oh well, the burden of running your own server.)
Anyway, thanks again.
Troy

Thursday, June 8, 2006

PRETTY GOOD, BUT THERE ARE SOME ISSUES.

11:39PM PDT · crocodile2u
I have aquired your approach in my application.
However, I have made just 4 methods in my class:
three that you have mentioned (__construct, assign, _run) and also _script() - to avoid redundant Zend_Exception:


/**


* Overrides parent's method.


* @param $name string The base name of the script.


* @return void


*/


protected function _script($name)


{


return $name;


}

The main issue in your code (IMHO) is the following: you are extending the Zend_View_Abstract interface by adding several new methods that are not present in the abstract class. This cannot be considered a problem until one day you decide that Smarty is no good - and you should fall back to using Zend_View instead.
Then you can extend the Zend_View and make Torello_View_Zend class with stub methods, and that will be ok - but I think you should mention this in your article.

Monday, June 12, 2006

RUN.PHP ?

9:05AM PDT · myaticav
I'm getting this error when running the implementation.

"Uncaught exception 'Zend_Exception' with message 'File "Zend/View/Helper/run.php" was not found"

Seems that the file run.php is not part of the Zend Framework.

Any Idea ?

Wednesday, June 13, 2007

ZEND_VIEW_SMARTY

1:16PM PDT · scubamatrix
The code does not appear to work in RC1 or RC2 versions of the framework

Help please.

Tuesday, June 19, 2007

DESIGN HELP

6:09AM PDT · inter81
Hello, friends!
What can you say about design of my sites?
<a href="http://eumcci.com/htm/images/artical/data/index.php">sex toy</a>
<a href="http://eumcci.com/htm/images/artical/data/?page=1">adult sex toy</a>
<a href="http://eumcci.com/htm/images/artical/data/?page=2">sex toy party</a>
<a href="http://eumcci.com/htm/images/artical/data/?page=3">sex toy for man</a>
<a href="http://eumcci.com/htm/images/artical/data/?page=4">homemade sex toy</a>

DESIGN HELP

6:10AM PDT · inter81
Hello, friends!
What can you say about design of my sites?
<a href="http://eumcci.com/htm/images/artical/data/index.php">sex toy</a>
<a href="http://eumcci.com/htm/images/artical/data/?page=1">adult sex toy</a>
<a href="http://eumcci.com/htm/images/artical/data/?page=2">sex toy party</a>
<a href="http://eumcci.com/htm/images/artical/data/?page=3">sex toy for man</a>
<a href="http://eumcci.com/htm/images/artical/data/?page=4">homemade sex toy</a>

DESIGN HELP

6:11AM PDT · inter81
Hello, friends!
What can you say about design of my sites?
<a href="http://eumcci.com/htm/images/artical/data/index.php">sex toy</a>
<a href="http://eumcci.com/htm/images/artical/data/?page=1">adult sex toy</a>
<a href="http://eumcci.com/htm/images/artical/data/?page=2">sex toy party</a>
<a href="http://eumcci.com/htm/images/artical/data/?page=3">sex toy for man</a>
<a href="http://eumcci.com/htm/images/artical/data/?page=4">homemade sex toy</a>

Thursday, August 2, 2007

INTEGRATING TEMPLATELITE WITH ZEND VIEW

7:26AM PDT · borec86
Hello.

I am currently developing my own framework based on ZF and decided to use TemplateLite as template engine.

In response to octavian82 question, I give you Phlame_View_Tpl integrating TemplateLite with Zend View.

You can view the source here: http://dev.inetive.pl/phlame/Phlame_View_Tpl.phps
And here is some example.

The template: http://dev.inetive.pl/phlame/test_template.tpl
The example code: http://dev.inetive.pl/phlame/tpl_test.phps
And the result: http://dev.inetive.pl/phlame/tpl_test.php
I would appreciate any comments and ideas.

-----------------------------------------------------------------------------------------------------------------------------------------

如果需要数码相机、笔记本电池请到我自己的网站 http://www.buy8.cc,不需要 的朋友可以帮我点击一下,提升一下我网站的流量,多谢了

smarty = false;


    


    public function __construct($data = array())


    {


        parent::__construct($data);


        


        $config = Zend::registry('config');


        


        $this->_smarty = new Smarty();


        


        $this->_smarty->caching = $config->getSetting('smarty', 'caching');


        $this->_smarty->cache_lifetime = $config->getSetting('smarty', 'cache_lifetime');


        $this->_smarty->template_dir = $config->getSetting('smarty', 'template_dir');


        $this->_smarty->compile_dir = $config->getSetting('smarty', 'compile_dir');


        $this->_smarty->config_dir = $config->getSetting('smarty', 'config_dir');


        $this->_smarty->cache_dir = $config->getSetting('smarty', 'cache_dir');


    }



Implement _run() method

The method _run() is the only method that needs to be implemented in any subclass of Zend_View_Abstract. It is called automatically within the render() method. My implementation just uses the display() method from Smarty to generate and output the template.

___FCKpd___2

Overwrite assign() method

The next part is an overwrite of the assign() method from Zend_View_Abstract, which works in a similar way. The big difference is that the values are assigned to the Smarty object and not to the $this->_vars variables array of Zend_View_Abstract.

___FCKpd___3

Overwrite escape() method

The next part is an overwrite of the escape() method from Zend_View_Abstract. It works both for string and array values and also uses the escape() method from the Zend_View_Abstract. The advantage of this is that I don't have to care about each value of an array to get properly escaped.

___FCKpd___4

Print the output

The next method output() is a wrapper on the render() method from Zend_View_Abstract. It just sets some headers before printing the output.

___FCKpd___5

Use Smarty caching

The last two methods were created to simply integrate the Smarty caching mechanism in the View class. With the first one you can check for cached template and with the second one you can set the caching on or of.

___FCKpd___6

That was the complete code of my Travello_View_Smarty class.

How to use the class

The usage of this class is quite simple. In your bootstrap file you can initialize it like this. The $viewConfig is used to setup the Zend_View paths. After creation the object is registered in the object store for later usage.

___FCKpd___7

Within your controller an action method could look like this.

___FCKpd___8

Conclusion

That was basically it. I have a couple of ideas how to extend this solution, but it already does the work for me. Any comments are welcome.

Updated on April 18, 2006

Please have also a look at the follow-up article on Integrating Sarty and ez Components with the Zend Framework.

Digg This!

Comments

Add Comment

Tuesday, April 4, 2006

RELATED ARTICLE ON SMARTY CACHING

1:59PM PDT · Jayson Minard (editor)

PHPDeveloper.org just pointed out a related article on caching using Smarty. This will fit nicely with what Ralf has written here.

Wednesday, April 5, 2006

CONFIG CLASS

2:24AM PDT · jmkeith
Are you using some sort of Config class to handle the getSetting() method, etc?

CONFIG CLASS

3:03AM PDT · Ralf Eggert
Hi,

currently I am using the ezcConfiguration and ezcConfigurationIniReader from the ezComponents http://ez.no/doc/components/view/latest/(file)/introduction_Configuration.html
To integrate the ezComponents within the Zend Framework I put the ezComponents directory in my include_path and use a slightly different __autoload() function:


<pre>


include_once 'Zend.php';


include_once 'Base/src/base.php';




function __autoload($class)


{


if ('ezc' == substr($class, 0, 3))


{


ezcBase::autoload($class);


}


else


{


Zend::loadClass($class);


}


}


</pre>

To use the Configuration component I set it up and store the configuration object in the object store of the Zend Framework.


<pre>


$reader = new ezcConfigurationIniReader();


$reader->init('path/to/your/ini/files', 'settings.ini');


$config = $reader->load();


Zend::register('config', $config);


</pre>

That is basically it.

HTH, Ralf

GRMBL

3:05AM PDT · Ralf Eggert
The HTML markup doesn't seem to work in the comments. But hopefully you get the point.

SMARTY DESING AND INTERNATIONALIZATION

5:53AM PDT · hzubieta
It sounds good!!; the integration with Smarty is saving-time idea. I had used in my own Application Framework for while, it had save me a lot of time, I used in conjunction with Dreamweaver and the software interface is complete independent from the application coding: Zend Studio for Coding and Dreamweaver to designing.

If you redefined the Smarty Tags to "<?" and "?>" and uses Templates it allows you to see a really clean design in your design editor (there are other ways to do that, but this is quick!!). Templates also make it easy to develop huge interface changes in all your application on the fly without touching your code (the customers like that!!!) and taking advantage of the smarty cache management.

Another thing that helped me was the idea of Tom Anderson of adding a "T" block for Internationalization support. With this you, can even make your design in English and tagged all translatable text with "T" blocks and after use a Smarty-T- block plugin to support your application in different languages. I used in Japanese and I developed my own t block plug in like this:


function smarty_block_t($params, $content, &$this)


{


if (!$content) 


return $content;


return i18ngettext(trim($content));


}

The i18ngettext is a function that search into the localization files and returns the content with the translated phrase if it exists. I rewrite the i18ngettext in order to cached the files.

In design time text will look like:

<?t?>Translate me<?/T?>

Bye,

Hermann

Sunday, April 9, 2006

SMARTY AND HELPERS

11:30AM PDT · octavian82
Nice work. I wonder if it is possible to make use of the Zend_View Helpers out of the templates? I didn't manage to get it working.
For example if you created a Zend_View_Helper_MakeUrl and want to invoke it through a template:

<a href="{makeUrl('index','login')}">Login</a>

I don't think it is possible by using your approach because the helper method are unknown to the smarty object.
In my code is assigned a Zend_View Object that includes all output variables to the smarty object by doing:


$view = new Zend_View();


$view->template = 'index.html';


//add other output variables in the actioncontroller


$smarty = new Smarty();


//smarty cfg stuff




//at the end of the script


$smarty->assign('view', $view);


$smarty->display($view->template);



By doing this, smarty will automatically invoke the Zend_View::__call() method to unknown funktions, and that invokes the helper methods. the disadvantage is that you have to use:

<a href="{$view->makeUrl('index','login')}">Login</a>

which is a little more code, but it works for me.

One more Question: Did anyone manage to make TemplateLite (former SmartyLite) working with ZF?

regards, Marc

RE: SMARTY DESING AND INTERNATIONALIZATION

9:27PM PDT · Ralf Eggert
Hi Hermann,

thanks for your comments on internationalization. Sounds very good to me. For myself, I haven't come to that part yet, but your approach sounds reasonable to me.

Until now what I did was to assign an array called "translate" to Smarty and to access the translation via {$template.to_be_translate}.

Best Regards,

Ralf

RE: SMARTY AND HELPERS

9:30PM PDT · Ralf Eggert
Hi Marc,

you could easily assign the View object to Smarty as well by doing something like this in the _run() method:


protected function _run($template)


{


$this->_smarty->assign('view', $this);


$this->_smarty->display($template);


}



But I haven't tested this yet, so I might be wrong.

Best Regards,

Ralf

Monday, May 29, 2006

GREAT TUTORIAL

4:12AM PDT · tlmarker
Ralf,
I just wanted to drop a comment to tell you how much I appreciate this tutorial. I was in the process of starting a new project, and wanted to use a more stuctured approach. I was all ready using smarty without the Zend framework.
I knew I wanted to use the framework in my new project, but also wanted to use smarty. Your tutorial was the deciding factor in my changing to the Zend Framework. After spending most of yesterday downloading, and installing Apache I was able to get it working. (After spending a few hours learning how th configure Apache. Oh well, the burden of running your own server.)
Anyway, thanks again.
Troy

Thursday, June 8, 2006

PRETTY GOOD, BUT THERE ARE SOME ISSUES.

11:39PM PDT · crocodile2u
I have aquired your approach in my application.
However, I have made just 4 methods in my class:
three that you have mentioned (__construct, assign, _run) and also _script() - to avoid redundant Zend_Exception:


/**


* Overrides parent's method.


* @param $name string The base name of the script.


* @return void


*/


protected function _script($name)


{


return $name;


}

The main issue in your code (IMHO) is the following: you are extending the Zend_View_Abstract interface by adding several new methods that are not present in the abstract class. This cannot be considered a problem until one day you decide that Smarty is no good - and you should fall back to using Zend_View instead.
Then you can extend the Zend_View and make Torello_View_Zend class with stub methods, and that will be ok - but I think you should mention this in your article.

Monday, June 12, 2006

RUN.PHP ?

9:05AM PDT · myaticav
I'm getting this error when running the implementation.

"Uncaught exception 'Zend_Exception' with message 'File "Zend/View/Helper/run.php" was not found"

Seems that the file run.php is not part of the Zend Framework.

Any Idea ?

Wednesday, June 13, 2007

ZEND_VIEW_SMARTY

1:16PM PDT · scubamatrix
The code does not appear to work in RC1 or RC2 versions of the framework

Help please.

Tuesday, June 19, 2007

DESIGN HELP

6:09AM PDT · inter81
Hello, friends!
What can you say about design of my sites?
<a href="http://eumcci.com/htm/images/artical/data/index.php">sex toy</a>
<a href="http://eumcci.com/htm/images/artical/data/?page=1">adult sex toy</a>
<a href="http://eumcci.com/htm/images/artical/data/?page=2">sex toy party</a>
<a href="http://eumcci.com/htm/images/artical/data/?page=3">sex toy for man</a>
<a href="http://eumcci.com/htm/images/artical/data/?page=4">homemade sex toy</a>

DESIGN HELP

6:10AM PDT · inter81
Hello, friends!
What can you say about design of my sites?
<a href="http://eumcci.com/htm/images/artical/data/index.php">sex toy</a>
<a href="http://eumcci.com/htm/images/artical/data/?page=1">adult sex toy</a>
<a href="http://eumcci.com/htm/images/artical/data/?page=2">sex toy party</a>
<a href="http://eumcci.com/htm/images/artical/data/?page=3">sex toy for man</a>
<a href="http://eumcci.com/htm/images/artical/data/?page=4">homemade sex toy</a>

DESIGN HELP

6:11AM PDT · inter81
Hello, friends!
What can you say about design of my sites?
<a href="http://eumcci.com/htm/images/artical/data/index.php">sex toy</a>
<a href="http://eumcci.com/htm/images/artical/data/?page=1">adult sex toy</a>
<a href="http://eumcci.com/htm/images/artical/data/?page=2">sex toy party</a>
<a href="http://eumcci.com/htm/images/artical/data/?page=3">sex toy for man</a>
<a href="http://eumcci.com/htm/images/artical/data/?page=4">homemade sex toy</a>

Thursday, August 2, 2007

INTEGRATING TEMPLATELITE WITH ZEND VIEW

7:26AM PDT · borec86
Hello.

I am currently developing my own framework based on ZF and decided to use TemplateLite as template engine.

In response to octavian82 question, I give you Phlame_View_Tpl integrating TemplateLite with Zend View.

You can view the source here: http://dev.inetive.pl/phlame/Phlame_View_Tpl.phps
And here is some example.

The template: http://dev.inetive.pl/phlame/test_template.tpl
The example code: http://dev.inetive.pl/phlame/tpl_test.phps
And the result: http://dev.inetive.pl/phlame/tpl_test.php
I would appreciate any comments and ideas.

-----------------------------------------------------------------------------------------------------------------------------------------

如果需要数码相机、笔记本电池请到我自己的网站 http://www.buy8.cc,不需要 的朋友可以帮我点击一下,提升一下我网站的流量,多谢了
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息