[Solar-talk] doubts about layout and view dirs

Paul M Jones pmjones at solarphp.com
Tue Aug 8 06:28:35 PDT 2006


On Aug 8, 2006, at 7:53 AM, Rodrigo Moraes wrote:

> Hi.
> I think I'm using the layout dirs more than necessary. Is the
> directory /View in an application intended to store only the main
> content for views? And /Layout for common parts shared by many
> actions?

Exactly right.  Vendor/App/Layout/* is for layouts common to all  
applications, and Vendor/App/Example/Layout/* is for the Example app  
to override the common layout.  Layouts are for the site as a whole,  
and are intended to "wrap around" the main content of a page.

Similarly, Vendor/App/Example/View is for the Example main page  
content.  However, sometimes (like with error pages) a View is always  
the same regardless of the app, so common views are in Vendor/App/ 
View/*.

Hope that makes sense.


> I'm a bit lost trying to understand the different template stacks when
> you are inside a template or inside an action, sorry, and I'm missing
> something certainly. Is there a smart way to search for includes in
> /View or Layouts without changing the template paths? I mean, select
> views *or* layouts to be included in a template?

I'm not sure what you're asking here; the Solar_View object  
automatically looks in (e.g.) Vendor/App/Example/View/* first, then  
in Vendor/App/View/*, when you ask for a view.  Same thing for  
Layout.  Maybe an example would help me to understand.



--

Paul M. Jones  <http://paul-m-jones.com>

Solar: Simple Object Library and Application Repository
for PHP5.   <http://solarphp.com>

Savant: The simple, elegant, and powerful solution for
templates in PHP.   <http://phpsavant.com>




More information about the solar-talk mailing list