Hi grigri
Thanks for the reply.

I followed your suggestions but i can't get the code work.

No errors but also no outputs :\

BTW i modified a little bit the layout code

        <body>
                <div id="container">
                        <div id="header"><?php if (isset($header_for_layout)) { 
echo
$header_for_layout; } ?></div>
                        <div id="leftbar"><?php if (isset($leftbar_for_layout)) 
{  echo
$leftbar_for_layout; } ?></div>
                        <div id="rightbar"><?php if 
(isset($rightbar_for_layout)) {  echo
$rightbar_for_layout; } ?></div>
                        <div id="content"><?php if (isset($content_for_layout)) 
{  echo
$content_for_layout; } ?></div>
                        <div id="footer"><?php if (isset($footer_for_layout)) { 
 echo
$footer_for_layout; } ?></div>
                </div>
        </body>

Sorry for my n00bness :(


On 12 Nov, 17:55, grigri <[EMAIL PROTECTED]> wrote:
> Off the top of my head, I'd suggest using a helper combined with
> output buffering, like this:
>
> class ChunksHelper extends AppHelper {
>   var $chunkId = null;
>   var $append = false;
>   var $buffer = array();
>
>   function begin($chunkId, $append = false) {
>     if (empty($this->chunkId)) {
>       $this->chunkId = $chunkId;
>       $this->append = $append;
>       ob_start();
>     }
>   }
>
>   function end() {
>     if (!empty($this->chunkId)) {
>       $contents = ob_get_clean();
>       if ($this->append) {
>         if (isset($this->buffer[$this->chunkId])) {
>           $this->buffer[$this->chunkId] .= $contents;
>         }
>         else {
>           $this->buffer[$this->chunkId] = $contents;
>         }
>       }
>       else {
>         $this->buffer[$this->chunkId] = $contents;
>       }
>       $this->chunkId = false;
>     }
>   }
>
>   function beforeLayout() {
>     $View =& ClassRegistry::getObject('View');
>     foreach($this->buffer as $key => $value) {
>       $View->set($key . '_for_layout', $value);
>     }
>   }
>
> }
>
> Then in your view:
>
> <?php $chunks->begin('rightbar'); ?>
> This will end up in the right bar
> <?php $chunks->end(); ?>
>
> (The code might need a bit of modifying; I just wrote it quickly, but
> the idea is sound. You'll definitely want to add error-checking)
>
> hth
> grigri
>
> On Nov 12, 4:11 pm, i_Am_ToO_SeXy <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hello all.
> > First time posting here.
>
> > I have a 3-column layout where the 3rd column is intended to be a
> > menu.
> > here's the code
>
> > <html xmlns="http://www.w3.org/1999/xhtml"; lang="en" xml:lang="en">
> >         <head>
> >                 <?php
> >                         echo $scripts_for_layout;
> >                         echo $html->css("green", "stylesheet");
> >                 ?>
> >                 <title>Erny - <?php echo $title_for_layout; ?></title>
> >         </head>
> >         <body>
> >                 <div id="container">
> >                         <div id="header"><?php echo $header_for_layout; 
> > ?></div>
> >                         <div id="leftbar"><?php echo $leftbar_for_layout; 
> > ?></div>
> >                         <div id="rightbar"><?php echo $rightbar_for_layout; 
> > ?></div>
> >                         <div id="content"><?php echo $content_for_layout; 
> > ?></div>
> >                         <div id="footer"><?php echo $footer_for_layout; 
> > ?></div>
> >                 </div>
> >         </body>
> > </html>
>
> > The right menu should change his html code based on the current view.
> > I googled a lot but the only way i found is to use a Helper inside the
> > controller... that's not very MVC-ish...
> > So... is there any better way? :)
>
> > Thanks in advance.

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