Integrate Zend framework with smarty

Source: Internet
Author: User
Tags zend framework

Zend frameworkViewI don't want to use it for a short time. I still like it.Smarty.

First download the smarty, decompress it, andLibsCopy the folder and its content toLibraryDirectory, I like to change the name and rename itSmarty.

Open the application. ini file and add a line to configure resources. frontcontroller. noviewrenderer = 1 to disable the default Zend frameworkView.

Add smarty configuration information

{
Function onclick ()
{
This. style. display = 'none'; document. getelementbyid ('Code _ closed_text_102159 '). style. display = 'none'; document. getelementbyid ('Code _ open_image_102159 '). style. display = 'inline'; document. getelementbyid ('Code _ open_text_102159 '). style. display = 'inline ';
}
} "Id =" code_closed_image_102159 "style =" display: none "> {
Function onclick ()
{
This. style. display = 'none'; document. getelementbyid ('Code _ open_text_102159 '). style. display = 'none'; getelementbyid ('Code _ closed_image_102159 '). style. display = 'line'; getelementbyid ('Code _ closed_text_102159 '). style. display = 'inline ';
}
} "Id =" code_open_image_102159 "> Smarty
[ Staging: Production ]
Smarty. class_path =   " Smarty/smarty. Class. php "
Smarty. left_delimiter =   " <* "
Smarty. right_delimiter =   " *> "
Smarty. template_dir =   " Template "
Smarty. compile_dir =   " Compile "
Smarty. cache_dir =   " Cache "
Smarty. cache_lifetime =   600
Smarty. caching =   1

 

Open the Bootstrap. php file and add a function to initialize smarty.

 

{
Function onclick ()
{
This. style. display = 'none'; document. getelementbyid ('Code _ closed_text_102337 '). style. display = 'none'; document. getelementbyid ('Code _ open_image_102337 '). style. display = 'inline'; document. getelementbyid ('Code _ open_text_102337 '). style. display = 'inline ';
}
} "Id =" code_closed_image_102337 "style =" display: none "> {
Function onclick ()
{
This. style. display = 'none'; document. getelementbyid ('Code _ open_text_102337 '). style. display = 'none'; getelementbyid ('Code _ closed_image_102337 '). style. display = 'inline'; getelementbyid ('Code _ closed_text_102337 '). style. display = 'inline ';
}
} "Id =" code_open_image_102337 "> _ Initview
Public   Function _ Initview (){
$ Config   =   New Zend_config_ini (config_file_path ,   ' Staging ' );
Require_once   $ Config -> Smarty -> Class_path;

$ Smarty   =   New Smarty ();
$ Smarty -> Left_delimiter =   $ Config -> Smarty -> Left_delimiter;
$ Smarty -> Right_delimiter =   $ Config -> Smarty -> Right_delimiter;
$ Smarty -> Template_dir =   $ Config -> Smarty -> Template_dir;
$ Smarty -> Compile_dir =   $ Config -> Smarty -> Compile_dir;
$ Smarty -> Cache_dir =   $ Config -> Smarty -> Cache_dir;
$ Smarty -> Cache_lifetime =   $ Config -> Smarty -> Cache_lifetime;
$ Smarty -> Caching =   $ Config -> Smarty -> Caching;

Zend_registry::Set ('Smarty', $ Smarty);
}

 

Smarty is now integrated. Paste a little moreCodeRight

 

{
Function onclick ()
{
This. style. display = 'none'; document. getelementbyid ('Code _ closed_text_102554 '). style. display = 'none'; document. getelementbyid ('Code _ open_image_102554 '). style. display = 'inline'; document. getelementbyid ('Code _ open_text_102554 '). style. display = 'inline ';
}
} "Id =" code_closed_image_102554 "style =" display: none "> {
Function onclick ()
{
This. style. display = 'none'; document. getelementbyid ('Code _ open_text_102554 '). style. display = 'none'; getelementbyid ('Code _ closed_image_102554 '). style. display = 'inline'; getelementbyid ('Code _ closed_text_102554 '). style. display = 'inline ';
}
} "Id =" code_open_image_102554 "> Code
$ This -> Smarty = Zend_registry :: Get ( ' Smarty ' );
$ This -> Smarty -> Assign ( ' Bloguser ' ,   $ This -> Bloguser );
$ This -> Smarty -> Display ( $ Template );

 

There is an integrated method on the Internet that regards smarty as a plug-in of Zend framework. I think it is very troublesome. I am too lazy and still like to use it like this.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.