Page 1 of 1

Zend_Framework and Smarty, view problem

Posted: Mon Feb 11, 2008 1:59 am
by BornForCode
Hello guys,

I'm working now on a project that is made with ZF and Smarty and i have following issue: If i implement different modules in my application is easy for me to add the controllers in the front controller, but when i have to add also the view folders i saw that Smarty accepts only one folder as view.

Does anyone has found an workaround for this problem?

Re: Zend_Framework and Smarty, view problem

Posted: Mon Feb 11, 2008 1:33 pm
by RobertGonzalez
Moved to PHP - Code.

Re: Zend_Framework and Smarty, view problem

Posted: Mon Feb 11, 2008 1:34 pm
by RobertGonzalez
Can you manage view routes at all in the ZF? (I have no real experience with it so I am not sure if you can or not).

Re: Zend_Framework and Smarty, view problem

Posted: Mon Feb 11, 2008 1:37 pm
by BornForCode
You can, taking from example the module name, but in this case the smarty is the problem, i wish that they implement multiple folder support for their template_dir parameter.

Re: Zend_Framework and Smarty, view problem

Posted: Mon Feb 11, 2008 1:40 pm
by RobertGonzalez
I think the template_dir can be changed prior to parsing the view. Have you tried just resetting the template_dir property before calling the display() method (or whatever methods triggers the parse)?

Re: Zend_Framework and Smarty, view problem

Posted: Mon Feb 11, 2008 1:52 pm
by BornForCode
yes, you can change it in the init function from example (located in the controller) but i was looking for an embedded solution, perhaps i'm to lazy :mrgreen:

Re: Zend_Framework and Smarty, view problem

Posted: Mon Feb 11, 2008 2:30 pm
by jmut
yep, too lazy :)
In manual there is full implementation of
class Zend_View_Smarty implements Zend_View_Interface
http://framework.zend.com/manual/en/zen ... ripts.html

With little tweak you can make it work. You can then setScriptPath() on preDispatch of controller action helper ... (knowing the module, controller,action) to be executed you can easily can adjust where to look for templates