FAQ

Add new layout to your project

When upgrading your software the more efficient is to add a new layout to your existing software
-> this will show how to add a new layout
-> Efficiently connect the new layout to your existing software







# 1 > Download new layout

Purchase your new layout and download it to your computer
-> Move the source files into a folder in the WEBROOT of your software "Modules"
-> In our example we created our folder - We are going to link to all assets in our cakePHP project





# 2 > Create new layout

Create a new layout
-> b.ctp

Ensure the letter is a higher letter so you can easily integrate





# 3 > Integrate the layout

Open the 'index.html' from the files you downloaded

Copy all the contents into your b.ctp





# 4 > Link source files

The most efficient method to get running
-> is to link all source files into your modules directory

Create at the top of your layout

<?php $base = $this->webroot.'modules/NAMEOFLAYOUT/'; ?>





# 5 > Add base

Now all the locations which have a path
-> Simply add

<?= $base; ?>

into the path so it calls from our modules directory

This also ensures the modules directory will keep working





# 6 > Find / Replace

Now find and replace all locations to save time

Find and replace
src="../
src="<?= $base; ?>





# 7 > Setup test action in controller

Now we need a test action in our controller 

Create: 

Controller: Pages/newLayout()

View: Pages/new_layout.ctp





# 8 > Add our pages into our layout

We need to add the code which will inject each page into our layout

Find the html code which represents all the center content (meaning we want to LEAVE the header / footer / menu etc)
-> DELETE all the center code





# 9 > Add pages

Add the code

<?= $this->Element('a/flash-messages'); ?>
<?php echo $this->fetch('content'); ?>

Which will ensure your pages appear in your layout




# 10 > Copy and paste sections

The most efficient way to your build pages into to
-> Open the original layout from modules/NEWLAYOUT
-> Click through and find the section you want to use
-> Inspect that element
-> Copy -> outer
-> Paste that into your page