S raju
S raju

Reputation: 49

CakePhp: About Views

What is the difference between to these in cake php?

$this->fetch('title'); 




$this->extend('/Common/view');

$this->element('shop/cart.ctp');

Upvotes: 1

Views: 78

Answers (2)

Anubhav
Anubhav

Reputation: 1623

You can learn lots from this online book/page:

http://book.cakephp.org/2.0/en/views.html

  1. View Templates
  2. Extending Views
    1. Using view blocks
    2. Displaying blocks
    3. Using blocks for script and CSS files
  3. Layouts
    1. Using layouts from plugins
  4. Elements
    1. Passing Variables into an Element
    2. Caching Elements
  5. Requesting Elements from a Plugin
  6. Creating your own view classes
  7. View API

Hope it will help you!

Upvotes: 2

XuDing
XuDing

Reputation: 2052

  • fetch() is used mainly in layout file to output a block of content.
  • extend() is used to extend view. which allows you to wrap one view in another.
  • element() is used to group an reusable piece of view.

Upvotes: 2

Related Questions