Re: [fw-general] Zend_Layout with nested layout?

2008-03-08 Thread SiCo007

I have just done something similiar, as I primarily thought this is what
Zend_Layout would do, basically I have the layout include a common header
and footer.

I know this is going back to the dark ages a little but it seemed like the
simplest fashion, and if you don't want a layout to use the standard header
and footer you simply delete the include from the layout.

I store everything in skins/layoutname and store the common header and
footer in skins/

skins
-- admin
-- default
-- header.php
-- footer.php

So each actual layout is a design in a skin, and the layout path is the
skin. For instance the default would be skins/admin/layout.php But if you
wanted a compact admin skin, you'd change the layout Zend_Layout would look
for to compact thus giving skins/admin/compact.php

Therefore the header/footer system seems to work well:
render('../header.php'); ?>

I don't know if this is perfect and it probably has lots of downsides but it
works for me, I'm interested to hear others takes on 'skinning' with
Zend_Layout. I realise people might be dubious of having designers add the
render call, but they have to add the calls to display content so!

Simon



Jeffrey Sambells-2 wrote:
> 
> Hi All,
> 
> I'm just playing with Zend_Layout and have a quick question. What I'd  
> like to do is have a three part view. I'd like my designer to design a  
> wrapper "template" that consists of the markup surrounding the output  
> of action views. This is exactly what Zend_Layout does so perfect! but  
> if possible I'd like the designer templates to exclude the doctype,  
> head and  and  tag stuff and stick strictly to what comes  
> after .  That way designers don't need to worry about the non- 
> design stuff.
> 


-
Simon Corless

http://www.ajb007.co.uk/
-- 
View this message in context: 
http://www.nabble.com/Zend_Layout-with-nested-layout--tp15878224s16154p15912865.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend_Layout with nested layout?

2008-03-08 Thread Christian Ehmig



> 
> I'm just playing with Zend_Layout and have a quick question. What I'd  
> like to do is have a three part view. I'd like my designer to design a  
> wrapper "template" that consists of the markup surrounding the output  
> of action views. This is exactly what Zend_Layout does so perfect! but  
> if possible I'd like the designer templates to exclude the doctype,  
> head and  and  tag stuff and stick strictly to what comes  
> after .  That way designers don't need to worry about the non-
> design stuff.
> 
> doc.phtml:
> 
>   PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> 
> 
>  
>  headTitle() ?>
>  headScript() ?>
>  headStyle() ?>
> 
> 
> layout()->content ?>
> 
> 
> 
> which includes the following designer layout.phtml in "content":
> 
> 
> 
> layout()->nav ?>
> 
> layout()->content ?>
> 
> 
> which includes the action.phtml template in "content". 
> 


You could probably create a view helper like this:

class My_View_Helper_NestedLayout
{   
  
public function nestedLayout($layoutName)
{
try { 
$layout = Zend_Layout::getMvcInstance();

echo $layout->render($layoutName);
}
} catch (Zend_Exception $e) {
$this->view->layout($layoutName);
}
}   

public function setView(Zend_View_Interface $view)
{
$this->view = $view;
}
}

add the helper path (see
http://framework.zend.com/manual/en/zend.view.helpers.html#zend.view.helpers.custom)

Usage in your main layout (doc.phtml):

...
nestedLayout('content/layout') ?>   
...

this would render the layout file 'content/layout.phtml' (relative to your
layout path) at the position where like to render the content.


Please correct me if this might fail in any case!
-- 
View this message in context: 
http://www.nabble.com/Zend_Layout-with-nested-layout--tp15878224s16154p15912857.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Zend_Layout with nested layout?

2008-03-06 Thread Jeffrey Sambells

Hi All,

I'm just playing with Zend_Layout and have a quick question. What I'd  
like to do is have a three part view. I'd like my designer to design a  
wrapper "template" that consists of the markup surrounding the output  
of action views. This is exactly what Zend_Layout does so perfect! but  
if possible I'd like the designer templates to exclude the doctype,  
head and  and  tag stuff and stick strictly to what comes  
after .  That way designers don't need to worry about the non- 
design stuff.


The question is how to wrap the head and whatnot around the layout?

I thought of extending the ViewRendered render() method to accomplish  
this, which would work, however I wasn't sure if there was a native  
way to have a Zend_Layout within a Zend_Layout so that I could have:


doc.phtml:

http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>




headTitle() ?>
headScript() ?>
headStyle() ?>


   layout()->content ?>



which includes the following designer layout.phtml in "content":



layout()->nav ?>

layout()->content ?>


which includes the action.phtml template in "content".


Thanks.

- Jeffrey