On Oct 31, 10:37 am, Marcin Jaworski <[EMAIL PROTECTED]> wrote:
> Hi.
>
> This is me again :).
>
> I did the search and I found a possible solution using ob_start() and
> ob_get_clean() functions. Like in my previous ideas it is something
> like content placeholders.
>
> view:
>
> <div>This is some view. This is it's main content</div>
> <? ob_start(); ?>
> this content won't be rendered as $content_for_layout
> <? $GLOBALS['namedContents']['somename'] = ob_get_clean(); ?>
>
> then in layout:
>
> <div id="leftcol"><?= $content_for_layout ?></div>
> <div id="rightcol">
> <? if (isset($GLOBALS['namedContents']['somename'])) { echo
> $GLOBALS['namedContents']['somename']; } else { ?>
> Here goes the default content for this placeholder
> <? } ?>
> </div>
>
> When no default content is required then just simply <?=
> $GLOBALS['namedContents']['somename'] ?> where it is needed.
>
> However I haven't tested this yet. It's only an idea. Maybe it could
> be wrapped in a Helper?
>
> This should not break existing buffering using ob_start() because as I
> have read on in the php manual, buffers are stackable (it is possible
> to call ob_start inside a buffer and this will create a new buffer on
> top of that first).

Wow! Seems very complex. Why no to try the simple methodology of
CakePHP and use elements (http://bakery.cakephp.org/articles/view/
creating-reusable-elements-with-requestaction) to create reusable
parts of code that you can put everywhere...
An advice... Always try to solve first in the Cake way, i´m sure
you`re gonna save a lot of time.

Have a nice day.


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

Reply via email to