Younger brother, I used the ZF box to integrate smarty. An exception occurred. please read it for help.

Source: Internet
Author: User
Tags 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 first created application/views/templates and application/views/template respectively. I used the ZF box to integrate smarty, and an error occurred. please take a look.
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 ()

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.