My concrete case:

In a CMS-like app, I have modules that can be attached to layout positions. 
Layout positions are vars echoed in each layout. So, I use a loader element, 
placed at the top of each layout, that should load each position var with 
his own output.

Layout example:

<head>
<?php echo $this->elements('loader'); ?>
</head>
<body>
...
<?php echo $position1; ?>
...
<?php echo $position2; ?>
...
</body>

Loader behavior:

foreach ($modules as $position => $attached_modules) {
foreach ($attached_modules as $model) {
 $output[$positions] .= $this->element($model);
}

$this->set($output);
}

Something like that. Code is not that way exactly, but I think it's enough 
to get the idea. The problem is that the $this->set at the bottom of loader 
element sets the var in viewVars attribute, but doesn't populate the vars to 
be accessed straight in the layout (as said in the doc, here: 
http://book.cakephp.org/view/1086/set)

I know I could call each element in each position, but it will mess up the 
layout code and difficult creating or editing layouts, instead the elegant 
echo $position ^^

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to