You can do it through a quick hack, though it is not very elegant. Let's say
that on your view you have:
<?php echo $this->renderElement('element1', array('arg1' => 'Hello', 'arg2'
=> 'World')); ?>
And element1 includes element2. Element2 looks like:
<?php echo $arg1 . ' ' . $arg2; ?>
Then the hack is to make element1 look like:
<?php
$loaded = am(array_keys($this->viewVars), array_keys($this->loaded));
$args = array_diff_key($___dataForView, array_flip($loaded));
echo $this->renderElement('element2', $args);
?>
-MI
---------------------------------------------------------------------------
Remember, smart coders answer ten questions for every question they ask.
So be smart, be cool, and share your knowledge.
BAKE ON!
blog: http://www.MarianoIglesias.com.ar
________________________________________
De: [email protected] [mailto:[EMAIL PROTECTED] En nombre
de Gonzalo Servat
Enviado el: Sábado, 21 de Abril de 2007 08:35 p.m.
Para: [email protected]
Asunto: Re: Passing arguments to a nested element
.. but not quite the solution I was looking for. What I'm trying to avoid is
having to specifically write each and every variable in either method. I was
hoping for a way to grab them all and send the arguments to the next
renderElement call. Maybe I understood how to use compact? I'd really
appreciate an example.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---