I use them mainly for injecting little bits of javascript... but
essentially you:
1) create a view or an element
2) stick the "block" code in that view or element
3) echo that "block" in a view or element which is currently being loaded.
e.g.
default.ctp
<?php echo $this->element('sidebar'); ?>
sidebar.ctp
<?php
$this->start('sidebar.block');
// block code...
$this->end();
// other code for the side bar
echo $this->fetch('sidebar.block');
?>
or you could fetch the sidebar in the layout..
there is no magic "blocks" folder which stores all the blocks - thats what
elements are for.
On Mon, Oct 8, 2012 at 10:42 AM, Advantage+ <[email protected]> wrote:
> If I place <?php echo $this->fetch('sidebar'); ?> in a view or layout where
> is sidebar?
> In View? Element? Tried both and still nothing shows up.
>
> In a Block folder?
>
> Book does not say what sidebar is or where its saved?
>
> Any insight?
>
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On
> Behalf
> Of Dr. Tarique Sani
> Sent: Sunday, October 07, 2012 4:49 AM
> To: [email protected]
> Subject: Re: How to use blocks?
>
> Have you actually tried writing some code as explained in the book?
>
> If yes then show us the code
>
> Tarique
>
> On Sun, Oct 7, 2012 at 11:26 AM, Advantage+ <[email protected]> wrote:
> > I cannot seem to figure this out.
>
> --
> =============================================================
> The Conference Schedule Creator : http://shdlr.com
>
> PHP for E-Biz : http://sanisoft.com
> =============================================================
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter
> http://twitter.com/CakePHP
>
> ---
> 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].
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> 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].
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>
>
--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
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].
Visit this group at http://groups.google.com/group/cake-php?hl=en.