Thanks for the information.

Is there a good example where using a block is more sensible as compared to 
template?

On Friday, 14 December 2012 07:48:29 UTC+8, Reuben wrote:
>
> In CakePHP 2.1, Blocks are a part of the core, and are used to display 
> content, scripts and css as a part of the layout.
>
> You can start a block by simply writing to it, using any of the available 
> block commands (i.e. $this->start(), $this->assign(), $this->prepend(), 
> $this->append()), although your mileage may vary if you start appending to 
> a block that hasn't been created.
>
> Your example is using trying to use nested elements, rather than blocks.
>
> The strength of blocks is that you can write to them from helpers, 
> layouts, views and elements, and then choose to display the block at a 
> later time the view or layout processing.  
>
> Several helpers could write to a block that is displayed by an element, 
> and element would not need to know about those helpers.  Without blocks, 
> the element would need to know about those helpers to display the content.
>
> Regards
> Reuben Helms
>

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


Reply via email to