Lol, I think Zaky really likes elements as I am seeing that short post
of his more and more, and probably rightly so as this does seem to be
the commonly accepted way to tackle the issue of sidebars.

However, can I throw what I am doing open for discussion so my errors
can be corrected if necessary.  It uses elements, but not sure if I am
passing in data in the commonly accepted manner.

I have an element called side_content.ctp:
<?php
if(isset($data)):
  foreach($data AS $row):
    echo $this->element($row['element'], array('data'=>$row['data']));
  endforeach;
endif;

I then pass that a data array with something like the following
Array
(
    [0] => Array
        (
            [element] => cause_profile_summary
            [data] => array('Cause'=>array('name'=>'Stokenchurch Dog
Rescue', ...))
        )
    [1] => Array
        (
            [element] => sub_menu_cause
            [data] => array('Cause'=>array('page_count'=>3, ...))
        )
    [2] => Array
        (
            [element] => latest_friends
            [data] => array('Freind'=>array(0=>array('name'=>'Friend
One', ...)))
        )

)

I form the array to be passed to the side_content element in my
controller pulling data in from related models, then in the view call
<?php if(isset($sideContent)) echo $this->element('side_content',
array('data'=>$sideContent)); ?>

Is this a sensible approach to dynamic content for side bars or should
I dump all of this and revert to:

http://book.cakephp.org/view/434/requestAction

I stayed clear of requestAction() previously as there was a lot of
discussion over performance issues, but now the book certainly seems
to reccomend it for this purpose.

Sorry to hijack the thread, but hopefully this lot should be a lot of
use in what you're doing.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" 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

Reply via email to