Create Element

Create elements so you can reuse code on multiple pages

# 1 > Create element

in your elements directory (app/View/Elements)

Create a version folder 

eg 'a'

Later when we launch the second version it will be 'b'


and place all the code within this

# 2 > Call the element

now in any view you can call this block of code

<?= $this->Element('a/menu'); ?>

This way you can place this single code on different pages and then when you update all the pages will update at once.

You can also pass in variables into the element

<?= $this->Element('a/menu', array(
      'variable' => $variable
); ?>