Younger brother, I used the ZF box to integrate smarty. An exception occurred. Please check it out.

Source: Internet
Author: User
Tags smarty template zend framework
I used the ZF box to integrate the smarty. An error occurred. please read it. I used the ZF box to integrate the smarty. An error occurred. please take a look. it seems to be a path error. I created the applicationviewstemplates and applicationviewstemplates_c and applicationviewstemplates_ccache_c folders respectively. Then integrate smarty with my ZF box. An error occurred. please read it.
I used the ZF box to integrate the smarty. An error occurred. please take a look. it seems to be a path error.
I created the application/views/templates and application/views/templates_c/cache_c folders respectively.
And then in the form of plug-ins. Load Smarty in index. php.
/*
* Date: 2009.8.16
* Author: DaGui
* Email: daguizhang@gmail.com
* QQ: 308713166
*/
Error_reporting (E_ALL | E_STRICT );
Date_default_timezone_set ('Asia/Shanghai ');
Define ('web _ root', 'http: // 192.168.12.190: 81/vote /');
Set_include_path ('.'. PATH_SEPARATOR. './library'. PATH_SEPARATOR. './application/models/'. PATH_SEPARATOR. get_include_path ());
Require_once 'zend/Loader. php ';
Zend_Loader: registerAutoload (); // sets Zend Framework to automatically load class files
$ Registry = Zend_Registry: getInstance ();

// Configure database parameters and connect to the database
$ Config = new Zend_Config_Ini ('./application/config. ini', null, true );
Zend_Registry: set ('config', $ config );
$ DbAdapter = Zend_Db: factory ($ config-> general-> db-> adapter, $ config-> general-> db-> config-> toArray ());
$ DbAdapter-> query ('set NAMES utf8 ');
Zend_Db_Table: setdefaadapter adapter ($ dbAdapter );
Zend_Registry: set ('dbadapter ', $ dbAdapter );

// Initialize the smarty Template
Include 'smarty/Smarty. class. php ';
$ Views = new Smarty ();
$ Views-> left_delimiter = "{{";
$ Views-> right_delimiter = "}}";
$ Views-> compile_dir = 'application/views/templates_c ';
$ Views-> cache_dir = 'application/views/templates_c/cache_c ';
$ Views-> template_dir = 'application/views/templates ';
Function smarty_block_dynamic ($ param, $ content, & $ views)
{
Return $ content;
}
$ Views-> register_block ('dynamic ', 'smarty _ block_dynamic', false );
Zend_Registry: set ('Views ', $ views );

// Create a verification object
$ Auth = Zend_Auth: getInstance ();
// Create an access permission object
$ Acl = new Common_Plugin_MyAcl ();

// Set the controller
$ FrontController = Zend_Controller_Front: getInstance ();
$ FrontController-> setBaseUrl ('/vote') // set the basic path
-> SetParam ('noviewrenderer', true)
-> RegisterPlugin (new Common_Plugin_MyAuth ($ auth, $ acl ))
-> RegisterPlugin (new Zend_Controller_Plugin_ErrorHandler ())
-> SetControllerDirectory ('./application/controllers ')
-> ThrowExceptions (true)
-> Dispatch ();
?>


My code on the controller layer is as follows:
Class IndexController extends Zend_Controller_Action
{
Protected $ views;/* template object */
Protected $ data;/* object for passing Template variables */
Function init ()
{
$ This-> registry = Zend_Registry: getInstance ();
$ This-> views = Zend_Registry: get ('View ');
$ This-> data = $ this-> _ request-> getBaseUrl ();
}

Public function smartyAction ()
{
Large-Scale Price Reduction
  • 59% Max. and 23% Avg.
  • Price Reduction for Core Products
  • Price Reduction in Multiple Regions
undefined. /
Connect with us on Discord
  • Secure, anonymous group chat without disturbance
  • Stay updated on campaigns, new products, and more
  • Support for all your questions
undefined. /
Free Tier
  • Start free from ECS to Big Data
  • Get Started in 3 Simple Steps
  • Try ECS t5 1C1G
undefined. /

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.