application.ini - config controllers and layouts, but not pages?

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

application.ini - config controllers and layouts, but not pages?

Artsemis
As implied by the subject, why do you config the base directory here for most things (specifically controllers) but can't for pages? Where can you change the path to pages?
Reply | Threaded
Open this post in threaded view
|

Re: application.ini - config controllers and layouts, but not pages?

weierophinney
Administrator
-- Artsemis <[hidden email]> wrote
(on Thursday, 17 September 2009, 01:28 PM -0700):
> As implied by the subject, why do you config the base directory here for most
> things (specifically controllers) but can't for pages? Where can you change
> the path to pages?

What do you mean by "pages"? Since ZF is front controller driven, all
"pages" of a ZF website are the result of controller actions...

--
Matthew Weier O'Phinney
Project Lead            | [hidden email]
Zend Framework          | http://framework.zend.com/
Reply | Threaded
Open this post in threaded view
|

Re: application.ini - config controllers and layouts, but not pages?

Artsemis

Matthew Weier O'Phinney-3 wrote
-- Artsemis <artsemis@gmail.com> wrote
(on Thursday, 17 September 2009, 01:28 PM -0700):
> As implied by the subject, why do you config the base directory here for most
> things (specifically controllers) but can't for pages? Where can you change
> the path to pages?

What do you mean by "pages"? Since ZF is front controller driven, all
"pages" of a ZF website are the result of controller actions...

--
Matthew Weier O'Phinney
Project Lead            | matthew@zend.com
Zend Framework          | http://framework.zend.com/
Thanks for the response. You're on the right track but sorry I wasn't clear -- I'm referring to the location of the pages that the controller accesses. You are required to specify in the config where the controllers are located but not the base directory that holds all of the pages -- they default to /views/scripts. Is this changeable anywhere?

Thanks!
Reply | Threaded
Open this post in threaded view
|

Re: application.ini - config controllers and layouts, but not pages?

Shaun Farrell
Artsemis,

Check out this http://framework.zend.com/manual/en/zend.view.controllers.html

I also think you can override the viewRenderer.  Below is an example from framework.zend.com and shows how to use smarty.  I assume if you just change the setViewBasePathSpec to your dir that might work.  haven't tested it but worth a try


$view = new Zend_View_Smarty('/path/to/templates');
$viewRenderer =
    new Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
$viewRenderer->setView($view)
             ->setViewBasePathSpec($view->_smarty->template_dir)
             ->setViewScriptPathSpec(':controller/:action.:suffix')
             ->setViewScriptPathNoControllerSpec(':action.:suffix')
             ->setViewSuffix('tpl');


On Thu, Sep 17, 2009 at 9:45 PM, Artsemis <[hidden email]> wrote:



Matthew Weier O'Phinney-3 wrote:
>
> -- Artsemis <[hidden email]> wrote
> (on Thursday, 17 September 2009, 01:28 PM -0700):
>> As implied by the subject, why do you config the base directory here for
>> most
>> things (specifically controllers) but can't for pages? Where can you
>> change
>> the path to pages?
>
> What do you mean by "pages"? Since ZF is front controller driven, all
> "pages" of a ZF website are the result of controller actions...
>
> --
> Matthew Weier O'Phinney
> Project Lead            | [hidden email]
> Zend Framework          | http://framework.zend.com/
>
>

Thanks for the response. You're on the right track but sorry I wasn't clear
-- I'm referring to the location of the pages that the controller accesses.
You are required to specify in the config where the controllers are located
but not the base directory that holds all of the pages -- they default to
/views/scripts. Is this changeable anywhere?

Thanks!
--
View this message in context: http://www.nabble.com/application.ini---config-controllers-and-layouts%2C-but-not-pages--tp25492249p25501912.html
Sent from the Zend Framework mailing list archive at Nabble.com.




--
Shaun J. Farrell
Washington, DC
(202) 713-5241
www.farrelley.com
Reply | Threaded
Open this post in threaded view
|

Re: application.ini - config controllers and layouts, but not pages?

Artsemis
Shaun Farrell wrote
Artsemis,

Check out this
http://framework.zend.com/manual/en/zend.view.controllers.html

I also think you can override the viewRenderer.  Below is an example from
framework.zend.com and shows how to use smarty.  I assume if you just change
the setViewBasePathSpec to your dir that might work.  haven't tested it but
worth a try


$view = new Zend_View_Smarty('/path/to/templates');
$viewRenderer =
    new Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
$viewRenderer->setView($view)
             ->setViewBasePathSpec($view->_smarty->template_dir)
             ->setViewScriptPathSpec(':controller/:action.:suffix')
             ->setViewScriptPathNoControllerSpec(':action.:suffix')
             ->setViewSuffix('tpl');



On Thu, Sep 17, 2009 at 9:45 PM, Artsemis <artsemis@gmail.com> wrote:

>
>
>
> Matthew Weier O'Phinney-3 wrote:
> >
> > -- Artsemis <artsemis@gmail.com> wrote
> > (on Thursday, 17 September 2009, 01:28 PM -0700):
> >> As implied by the subject, why do you config the base directory here for
> >> most
> >> things (specifically controllers) but can't for pages? Where can you
> >> change
> >> the path to pages?
> >
> > What do you mean by "pages"? Since ZF is front controller driven, all
> > "pages" of a ZF website are the result of controller actions...
> >
> > --
> > Matthew Weier O'Phinney
> > Project Lead            | matthew@zend.com
> > Zend Framework          | http://framework.zend.com/
> >
> >
>
> Thanks for the response. You're on the right track but sorry I wasn't clear
> -- I'm referring to the location of the pages that the controller accesses.
> You are required to specify in the config where the controllers are located
> but not the base directory that holds all of the pages -- they default to
> /views/scripts. Is this changeable anywhere?
>
> Thanks!
> --
> View this message in context:
> http://www.nabble.com/application.ini---config-controllers-and-layouts%2C-but-not-pages--tp25492249p25501912.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
>


--
Shaun J. Farrell
Washington, DC
(202) 713-5241
www.farrelley.com
Perfect, thanks for this :)  I still think it's odd that controllers require a config entry and views have a hard-coded start path but this is what I was wanting. Thanks!
Reply | Threaded
Open this post in threaded view
|

Re: application.ini - config controllers and layouts, but not pages?

SpiffyJr

Artsemis wrote
Shaun Farrell wrote
Artsemis,

Check out this
http://framework.zend.com/manual/en/zend.view.controllers.html

I also think you can override the viewRenderer.  Below is an example from
framework.zend.com and shows how to use smarty.  I assume if you just change
the setViewBasePathSpec to your dir that might work.  haven't tested it but
worth a try


$view = new Zend_View_Smarty('/path/to/templates');
$viewRenderer =
    new Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
$viewRenderer->setView($view)
             ->setViewBasePathSpec($view->_smarty->template_dir)
             ->setViewScriptPathSpec(':controller/:action.:suffix')
             ->setViewScriptPathNoControllerSpec(':action.:suffix')
             ->setViewSuffix('tpl');



On Thu, Sep 17, 2009 at 9:45 PM, Artsemis <artsemis@gmail.com> wrote:

>
>
>
> Matthew Weier O'Phinney-3 wrote:
> >
> > -- Artsemis <artsemis@gmail.com> wrote
> > (on Thursday, 17 September 2009, 01:28 PM -0700):
> >> As implied by the subject, why do you config the base directory here for
> >> most
> >> things (specifically controllers) but can't for pages? Where can you
> >> change
> >> the path to pages?
> >
> > What do you mean by "pages"? Since ZF is front controller driven, all
> > "pages" of a ZF website are the result of controller actions...
> >
> > --
> > Matthew Weier O'Phinney
> > Project Lead            | matthew@zend.com
> > Zend Framework          | http://framework.zend.com/
> >
> >
>
> Thanks for the response. You're on the right track but sorry I wasn't clear
> -- I'm referring to the location of the pages that the controller accesses.
> You are required to specify in the config where the controllers are located
> but not the base directory that holds all of the pages -- they default to
> /views/scripts. Is this changeable anywhere?
>
> Thanks!
> --
> View this message in context:
> http://www.nabble.com/application.ini---config-controllers-and-layouts%2C-but-not-pages--tp25492249p25501912.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
>


--
Shaun J. Farrell
Washington, DC
(202) 713-5241
www.farrelley.com
Perfect, thanks for this :)  I still think it's odd that controllers require a config entry and views have a hard-coded start path but this is what I was wanting. Thanks!
Inside your controller you are able to do something like: $this->view->addScriptPath(APPLICATION_PATH . '/my/new/script/path/'). I haven't had the need to change it globally but you could probably do something like resources.view.scriptPath.<name> = "PATH". Correct me if I'm wrong someone.
Kyle S
blogs @ www.spiffyjr.me
github @ www.github.com/spiffyjr
follow @ www.twitter.com/spiffyjr
Reply | Threaded
Open this post in threaded view
|

Re: application.ini - config controllers and layouts, but not pages?

Shaun Farrell
Yeah i assume that would work too.  The ZF Manula says

In fact, you can "stack" paths using the addScriptPath() method. As you add paths to the stack, Zend_View will look at the most-recently-added path for the requested view script. This allows you override default views with custom views so that you may create custom "themes" or "skins" for some views, while leaving others alone.


On Fri, Sep 18, 2009 at 9:50 AM, Kyle Spraggs <[hidden email]> wrote:



Artsemis wrote:
>
>
> Shaun Farrell wrote:
>>
>> Artsemis,
>>
>> Check out this
>> http://framework.zend.com/manual/en/zend.view.controllers.html
>>
>> I also think you can override the viewRenderer.  Below is an example from
>> framework.zend.com and shows how to use smarty.  I assume if you just
>> change
>> the setViewBasePathSpec to your dir that might work.  haven't tested it
>> but
>> worth a try
>>
>>
>> $view = new Zend_View_Smarty('/path/to/templates');
>> $viewRenderer =
>>     new
>> Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
>> $viewRenderer->setView($view)
>>              ->setViewBasePathSpec($view->_smarty->template_dir)
>>              ->setViewScriptPathSpec(':controller/:action.:suffix')
>>              ->setViewScriptPathNoControllerSpec(':action.:suffix')
>>              ->setViewSuffix('tpl');
>>
>>
>>
>> On Thu, Sep 17, 2009 at 9:45 PM, Artsemis <[hidden email]> wrote:
>>
>>>
>>>
>>>
>>> Matthew Weier O'Phinney-3 wrote:
>>> >
>>> > -- Artsemis <[hidden email]> wrote
>>> > (on Thursday, 17 September 2009, 01:28 PM -0700):
>>> >> As implied by the subject, why do you config the base directory here
>>> for
>>> >> most
>>> >> things (specifically controllers) but can't for pages? Where can you
>>> >> change
>>> >> the path to pages?
>>> >
>>> > What do you mean by "pages"? Since ZF is front controller driven, all
>>> > "pages" of a ZF website are the result of controller actions...
>>> >
>>> > --
>>> > Matthew Weier O'Phinney
>>> > Project Lead            | [hidden email]
>>> > Zend Framework          | http://framework.zend.com/
>>> >
>>> >
>>>
>>> Thanks for the response. You're on the right track but sorry I wasn't
>>> clear
>>> -- I'm referring to the location of the pages that the controller
>>> accesses.
>>> You are required to specify in the config where the controllers are
>>> located
>>> but not the base directory that holds all of the pages -- they default
>>> to
>>> /views/scripts. Is this changeable anywhere?
>>>
>>> Thanks!
>>> --
>>> View this message in context:
>>> http://www.nabble.com/application.ini---config-controllers-and-layouts%2C-but-not-pages--tp25492249p25501912.html
>>> Sent from the Zend Framework mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>> --
>> Shaun J. Farrell
>> Washington, DC
>> (202) 713-5241
>> www.farrelley.com
>>
>>
>
> Perfect, thanks for this :)  I still think it's odd that controllers
> require a config entry and views have a hard-coded start path but this is
> what I was wanting. Thanks!
>

Inside your controller you are able to do something like:
$this->view->addScriptPath(APPLICATION_PATH . '/my/new/script/path/'). I
haven't had the need to change it globally but you could probably do
something like resources.view.scriptPath.<name> = "PATH". Correct me if I'm
wrong someone.

--
View this message in context: http://www.nabble.com/application.ini---config-controllers-and-layouts%2C-but-not-pages--tp25492249p25508994.html
Sent from the Zend Framework mailing list archive at Nabble.com.




--
Shaun J. Farrell
Washington, DC
(202) 713-5241
www.farrelley.com
Reply | Threaded
Open this post in threaded view
|

Re: application.ini - config controllers and layouts, but not pages?

Hector Virgen
You can configure the default base path of your views by adding this line to your application.ini:

resources.view.basePath = APPLICATION_PATH "/views/scripts"

Check out this page for more information: http://framework.zend.com/manual/en/zend.application.available-resources.html#zend.application.available-resources.view

--
Hector


On Fri, Sep 18, 2009 at 6:54 AM, Shaun Farrell <[hidden email]> wrote:
Yeah i assume that would work too.  The ZF Manula says

In fact, you can "stack" paths using the addScriptPath() method. As you add paths to the stack, Zend_View will look at the most-recently-added path for the requested view script. This allows you override default views with custom views so that you may create custom "themes" or "skins" for some views, while leaving others alone.


On Fri, Sep 18, 2009 at 9:50 AM, Kyle Spraggs <[hidden email]> wrote:



Artsemis wrote:
>
>
> Shaun Farrell wrote:
>>
>> Artsemis,
>>
>> Check out this
>> http://framework.zend.com/manual/en/zend.view.controllers.html
>>
>> I also think you can override the viewRenderer.  Below is an example from
>> framework.zend.com and shows how to use smarty.  I assume if you just
>> change
>> the setViewBasePathSpec to your dir that might work.  haven't tested it
>> but
>> worth a try
>>
>>
>> $view = new Zend_View_Smarty('/path/to/templates');
>> $viewRenderer =
>>     new
>> Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
>> $viewRenderer->setView($view)
>>              ->setViewBasePathSpec($view->_smarty->template_dir)
>>              ->setViewScriptPathSpec(':controller/:action.:suffix')
>>              ->setViewScriptPathNoControllerSpec(':action.:suffix')
>>              ->setViewSuffix('tpl');
>>
>>
>>
>> On Thu, Sep 17, 2009 at 9:45 PM, Artsemis <[hidden email]> wrote:
>>
>>>
>>>
>>>
>>> Matthew Weier O'Phinney-3 wrote:
>>> >
>>> > -- Artsemis <[hidden email]> wrote
>>> > (on Thursday, 17 September 2009, 01:28 PM -0700):
>>> >> As implied by the subject, why do you config the base directory here
>>> for
>>> >> most
>>> >> things (specifically controllers) but can't for pages? Where can you
>>> >> change
>>> >> the path to pages?
>>> >
>>> > What do you mean by "pages"? Since ZF is front controller driven, all
>>> > "pages" of a ZF website are the result of controller actions...
>>> >
>>> > --
>>> > Matthew Weier O'Phinney
>>> > Project Lead            | [hidden email]
>>> > Zend Framework          | http://framework.zend.com/
>>> >
>>> >
>>>
>>> Thanks for the response. You're on the right track but sorry I wasn't
>>> clear
>>> -- I'm referring to the location of the pages that the controller
>>> accesses.
>>> You are required to specify in the config where the controllers are
>>> located
>>> but not the base directory that holds all of the pages -- they default
>>> to
>>> /views/scripts. Is this changeable anywhere?
>>>
>>> Thanks!
>>> --
>>> View this message in context:
>>> http://www.nabble.com/application.ini---config-controllers-and-layouts%2C-but-not-pages--tp25492249p25501912.html
>>> Sent from the Zend Framework mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>> --
>> Shaun J. Farrell
>> Washington, DC
>> (202) 713-5241
>> www.farrelley.com
>>
>>
>
> Perfect, thanks for this :)  I still think it's odd that controllers
> require a config entry and views have a hard-coded start path but this is
> what I was wanting. Thanks!
>

Inside your controller you are able to do something like:
$this->view->addScriptPath(APPLICATION_PATH . '/my/new/script/path/'). I
haven't had the need to change it globally but you could probably do
something like resources.view.scriptPath.<name> = "PATH". Correct me if I'm
wrong someone.

--
View this message in context: http://www.nabble.com/application.ini---config-controllers-and-layouts%2C-but-not-pages--tp25492249p25508994.html
Sent from the Zend Framework mailing list archive at Nabble.com.




--
Shaun J. Farrell
Washington, DC
(202) 713-5241
www.farrelley.com

--
Hector Virgen