logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

Re: How about the include-path: msg#00015

Subject: Re: How about the include-path
-- Gaylord Aulke <gaylord.aulke-C1q0ot2/XZ0@xxxxxxxxxxxxxxxx> wrote
(on Tuesday, 13 February 2007, 09:32 AM +0100):
> I suggest changing the loading of the views to support respecting the 
> include path when the given script_path does not start with a '/'.
> And other places where similar things might happen.

Views work off their own set of directories and are done relative to
those directories:

    $view-> setScriptPath('/path/to/view/scripts');

    $view-> render('myview.tpl'); // renders /path/to/view/scripts/myview.tpl

Typically, you'll set the script path relative to your bootstrap:

    $view-> setScriptPath(dirname(__FILE__) . '/../app/views');

Zend_View also already allows specifying absolute paths; if an absolute
path is given, it won't look in its own list.

The path paradigm is true of controllers (setControllerDirectory()).
There's nothing saying you can't pass in the include_path as an argument
(though, in the case of controller directories, this won't be strictly
possible in the near future, as only one controller directory per module
will be allowed).

Am I missing something here?

> Andi Gutmans schrieb:
> > What part of the framework do you suggest we change and how? 
> >
> > > -----Original Message-----
> > > From: Gaylord Aulke [mailto:gaylord.aulke-C1q0ot2/XZ0@xxxxxxxxxxxxxxxx] 
> > > Sent: Sunday, February 11, 2007 5:40 AM
> > > To: fw-svn-wwOhfgvld6hpLGFMi4vTTA@xxxxxxxxxxxxxxxx; 
> > > fw-devteam-C1q0ot2/XZ0@xxxxxxxxxxxxxxxx
> > > Subject: How about the include-path
> > >
> > > Hi everyone,
> > >
> > > a quick question for discussion:
> > > How about making all references to pathes in Zend Framwork 
> > > able to use the include-path?
> > > This includes the loading of controlers and views.
> > > If you give absolute pathes, this does not change anything. 
> > > If you give relative pathes, the include path would be respected.
> > >
> > > Motivation:
> > > In the last years, my team and i have built a lot of big PHP 
> > > apps for different customers. We always had two problems there:
> > >
> > > 1st: the app must run on our test server and on the customers 
> > > servers. 
> > > With different directory structures.
> > > 2nd. we have a core part of the app that is the same for 
> > > every customer and custom parts that can override any 
> > > behaviour of the core part
> > >
> > > We found that it is a very simple and convenient way to use 
> > > the include-path for this:
> > > We set the include path in php.ini or Apache VHosts with two 
> > > components:
> > > include_path = <custom_basepath> :<core_basepath>
> > >
> > > All references to files (include, fopen etc.) in our 
> > > application are relative to this include-path. Whenever a 
> > > class should be loaded, PHP will try to find the custom class 
> > > first and if it does not find it, load the core class 
> > > instead. This solves most of the issues mentioned above and 
> > > keeps the application simple enough not to deal with pathes 
> > > and path-seperators etc. Works fine and we did not see any 
> > > performance impact so far.
> > >
> > > Gaylord
> > >
> >
> 

-- 
Matthew Weier O'Phinney
PHP Developer            | matthew-C1q0ot2/XZ0@xxxxxxxxxxxxxxxx
Zend - The PHP Company   | http://www.zend.com/



<Prev in Thread] Current Thread [Next in Thread>