Storefront Templates as Extensions
|Table of Contents|
AbanteCart offers a lot of flexibility to develop different layouts for pages with set collection of blocks assigned per layout per page. Important to note that layout system is only used in pages for storefront. Responses and Control Panel pages do not utilize layout system. Each layout is linked to one template and one or multiple pages. Default layout is loaded if no other layout is found linked to given page.
Below diagrams demonstrate how page, layout and blocks are related to each other:
Why do you need layout for your extension?
Most of extensions of features add to AbanteCart will require display of information. This information might need to be shown in particular part of the page. This can be controlled with using a block to show information. This block can be set to needed part of the page with setting it in layout manager. The steps are the following: Add new block to layout manger, Add new block to layout. If layout is not known, user needs to be informed of the block and directed to layout manager in control panel to enable this block there it is desired.
Layout and blocks can be loaded with one XML files that will create all the database entries for the layout and block. There is a function loadXML() that is available in ALayoutManager class. This function can be called or if you
$layout = new ALayoutManager(); // Input possible with XML string, File or both. // We process both one at a time. XML string processed first $layout->loadXml(array('file' => $file)); $layout->loadXml(array('xml' => ‘xml string here’)); $layout->loadXml(array( 'file' => $file, 'xml' => ‘xml string here’ ));