|
|||
|
Frist of all I am a newbie to zf. I have been out of the programming scene for a while.
I came across zf and decided to take a look at it.After reading the manual and some other sites I started playing around with it. I guess first things first my directory structure Code:
/application
/config --holds zf config file
/controllers
/models
/Smarty -- Smarty specific folders
/cache
/config
/templates
/templates_c
/views
/index
/user
/library
/Smarty -- holds all smarty files
/Zend -- holds all zf files
.htaccess
index.php -- bootstrapper file
made a few adjustments to the Smarty.php script PHP Code:
PHP Code:
My IndexController.php looks like PHP Code:
If you need any more info just drop me a line. |
|
|||
|
Thanks for this, I spent the whole day trying to get Smarty working with Zend. I just followed your directory structure and got it working.
You may have already figured out, but all I did to get it to render is to echo out what is rendered. PHP Code:
|
|
|||
|
I followed you method..but I'm getting an error..can u please find out what is the error
Fatal error: Uncaught exception 'Zend_Controller_Dispatcher_Exception' with message 'Invalid controller specified (index)' in D:\php\m4u2\framework\library\Zend\Controller\Disp atcher\Standard.php:249 Stack trace: #0 D:\php\m4u2\framework\library\Zend\Controller\Fron t.php(914): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) #1 D:\php\m4u2\framework\index.php(48): Zend_Controller_Front->dispatch() #2 D:\php\m4u2\framework\public\index.php(2): include('D:\php\m4u2\fra...') #3 {main} thrown in D:\php\m4u2\framework\library\Zend\Controller\Disp atcher\Standard.php on line 249 |
|
|||
|
I have updated the code to fix a few problems and make the view default to the Smarty Directory structure
Code:
/application
/config --holds zf config file
/controllers -- Holds the Controllers needed for the script
IndexController.php
UserController.php
AdminController.php
/models
/Smarty -- Smarty specific folders
/cache
/config
/templates -- templates for the site are stored here
/templates_c --smarty cached directory
/modules
Whatever modules you want for the script
/images
/js
/library
/Smarty -- holds all smarty files
/Zend -- holds all zf files
.htaccess
index.php -- bootstrapper file
made a few adjustments to the Smarty.php script (This stayed the Same) PHP Code:
PHP Code:
PHP Code:
PHP Code:
|
|
|||
|
Changes are simple but made a lot more flexiblity in the script and in what we where trying to accomplish the use of the routes helped make the url short and sweet and search engine friendly.
It also Bypasses the views directory and goes straight to the smarty directory where all templates are stored. So we don't need to echo the rendered object it is displayed automatically when everything is done right. I hope this helps anyone that likes the flexibility of smarty if you find a better way of doing this and want to share drop me a line. Last edited by blurphp : 05-12-2008 at 11:57 PM. |