Page 1 of 1

show information section in header.tpl

Posted: Sat Oct 22, 2011 3:01 am
by zebdev
Hi there,

In the footer for open cart v1.5.1 there is a section called information. It has about us etc.

I want to put those links in my header.tpl file of my custom theme. So making opencart a cms for pages as well as the store.


If I copy this code from footer.tpl

Code: Select all

<ul>
      <?php foreach ($informations as $information) { ?>
      <li><a href="<?php echo $information['href']; ?>"><?php echo $information['title']; ?></a></li>
      <?php } ?>
    </ul>
I get an Undefined variable: informations error. Any direction on how to make this work?

Thank you

Re: show information section in header.tpl

Posted: Sun Oct 23, 2011 1:55 am
by uksitebuilder
You also need to move the associated entries in catalog/controller/common/footer.php to catalog/controller/common/header.php and possibly catalog/language/english/common/footer.php to catalog/language/english/common/header.php

OpenCart uses MVC+L

In simple terms there are multiple files that make up a section. The 'V' part of MVC+L is the 'tpl' files or 'View' It will most definitely have a Controller file 'C' and more than likely a Language file 'L'

The footer does not interact with the database directly, so there is no Model file 'M'

Re: show information section in header.tpl

Posted: Mon Oct 24, 2011 2:32 am
by zebdev
Excellent thank you. I'm learning slowly and have it all working.

Any ideas how I can create a new tpl file for an information page? So that I can choose a new template for an information page within the admin section?

E.g. new information page called postage and use a tpl file called template. which I have styled.