Well, that's sort of what <? include $this->element(...); ?> is for.
I'm not relucanct to add useful features, I'm just not going to
duplicate things that are already there.

Let's say I have a PostsController and a CommentsController, and when I
query the Post, the associated comments come with it.  So in the
example below, I want to use views/comments/view.thtml template in the
views/posts/view.thtml, let's also assume that the comments view file
expects a $comment variable to contain the details of the comment to be
rendered:

// app/views/posts/view.thtml:
<?
    foreach ($post['Comment'] as $comment) {
        include $this->element('../comments/view');
    }
?>

Actually, the same applies to renderElement, which can be used the same
as above, just slightly modified:
<?
    foreach ($post['Comment'] as $comment) {
        $this->renderElement('../comments/view', array('comment' =>
$comment));
    }
?>


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to