Page 1 of 1

How to place information module into header

Posted: Thu Sep 16, 2010 12:53 am
by KenjiRobbert
Hi
I want to place the 'information' module into the header horizontally. I already tried to copy the php code from the file information.tpl into the header.tpl (between the div4). But it seems I will not work:( Can somebody tell me how to do ?
Thanks in advance!

This is the code that's inside the information.tpl

Code: Select all

<div class="box">
  <div class="top"><img src="catalog/view/theme/default/image/information.png" alt="" /><?php echo $heading_title; ?></div>
  <div id="information" class="middle">
    <ul>
      <?php foreach ($informations as $information) { ?>
      <li><a href="<?php echo str_replace('&', '&', $information['href']); ?>"><?php echo $information['title']; ?></a></li>
      <?php } ?>
      <li><a href="<?php echo str_replace('&', '&', $contact); ?>"><?php echo $text_contact; ?></a></li>
      <li><a href="<?php echo str_replace('&', '&', $sitemap); ?>"><?php echo $text_sitemap; ?></a></li>
    </ul>
  </div>
  <div class="bottom">&nbsp;</div>
</div

Re: How to place information module into header

Posted: Thu Sep 16, 2010 1:21 am
by JAY6390
Open

Code: Select all

/catalog/controller/common/header.php
Find

Code: Select all

$this->render(); 
on a new line BEFORE it put

Code: Select all

$this->children = array('module/information'); 
Then in your

Code: Select all

catalog/view/theme/your-theme-name/template/common/header.tpl
put

Code: Select all

echo $information; 
This will echo the information module out there. Note you will need to disable the information module in the back end to stop it showing in the columns
if you want to remove the box around it, you will need to remove the divs etc from module/information.tpl in your template folder

NOTE: This is not tested, so it might not work, but should. MAKE BACKUPS BEFORE ATTEMPTING ANY OF THESE EDITS

Re: How to place information module into header

Posted: Thu Sep 16, 2010 5:25 am
by Maansy
this is a cool way Jay :)
i have done it differently but add it to the footer (same concept basicly).
the How-to is in my sig

good luck :)

Re: How to place information module into header

Posted: Thu Sep 16, 2010 5:32 am
by JAY6390
Yeah, you've made the links more customised. The method I used is to literally put the module in the header

Re: How to place information module into header

Posted: Fri Sep 17, 2010 1:41 am
by KenjiRobbert
Thanks for both replies!!It works:)

Re: How to place information module into header

Posted: Wed Nov 30, 2011 9:16 am
by Maffs
This tip now impossible with 1.5+

I am wanting to do the same thing, does anyone have any suggestions?

Re: How to place information module into header

Posted: Wed Nov 30, 2011 12:35 pm
by fido-x
Maffs wrote:This tip now impossible with 1.5+

I am wanting to do the same thing, does anyone have any suggestions?
The code posted above by Jay does work in the current version. You probably have some modification that is causing a conflict. For example, if you have a modification that already adds a children array (possibly through a vQmod) to the header by way of:

Code: Select all

$this->children = array('path/file'); 
then this will cause a conflict if you add another:

Code: Select all

$this->children = array('path/file'); 
ie. one will overwrite the other. Or, more to the point, replace one child module with another.

Re: How to place information module into header

Posted: Thu Dec 01, 2011 3:01 am
by Maffs
Thank you for replying. I stand corrected. I did a search for the

Code: Select all

$this->render();
and it came back with zero results the first time. This time I searched line by line and found it. Now I am not sure why Dreamweaver would do so poorly on a search.

Re: How to place information module into header

Posted: Fri Jan 13, 2012 10:21 pm
by sobiech1
Very helpful! Thanks for the tutorial.
I am having one "problem" with this now.
I need only 2 of 4 information pages in header. Any ideas how to exclude them?
Only id=3 and id=6 pages are needed. Maybe "if id=3 then echo..." somewhere would do the job? :)

I am not familiar with php that much...

PS. What should I add to header so variable $text_contact (link to mail-form from footer) will be available to use?

Re: How to place information module into header

Posted: Tue May 22, 2012 2:17 am
by JohnMaguire2013
Hey guys,

I wrote a quick vqMod script to add the $informations array which can be accessed in footer.tpl to the header.tpl. Simply upload this either through VQMod Manager, FTP, or your method of choice, as add_informations_to_header.xml

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<modification>
    <id>Add Information module to header template</id>
    <version>1.0.0</version>
    <vqmver>1.0.8</vqmver>
    <author>John Maguire - lulzplzkthx.com</author>
    
    <file name="catalog/controller/common/header.php">
        <operation>
            <search position="before"><![CDATA[$this->render();]]></search>
            <add><![CDATA[
            $this->load->model('catalog/information');
            
            $this->data['informations'] = array();
            foreach ($this->model_catalog_information->getInformations() as $result) {
                $this->data['informations'][] = array(
                    'title' => $result['title'],
                    'href'  => $this->url->link('information/information', 'information_id=' . $result['information_id'])
                );
            }
            ]]></add>
        </operation>
    </file>
</modification>
Hope this helps!

Re: How to place information module into header

Posted: Sun Sep 16, 2012 11:38 am
by retrobou
JohnMaguire2013 wrote:Hey guys,

I wrote a quick vqMod script to add the $informations array which can be accessed in footer.tpl to the header.tpl. Simply upload this either through VQMod Manager, FTP, or your method of choice, as add_informations_to_header.xml

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<modification>
    <id>Add Information module to header template</id>
    <version>1.0.0</version>
    <vqmver>1.0.8</vqmver>
    <author>John Maguire - lulzplzkthx.com</author>
    
    <file name="catalog/controller/common/header.php">
        <operation>
            <search position="before"><![CDATA[$this->render();]]></search>
            <add><![CDATA[
            $this->load->model('catalog/information');
            
            $this->data['informations'] = array();
            foreach ($this->model_catalog_information->getInformations() as $result) {
                $this->data['informations'][] = array(
                    'title' => $result['title'],
                    'href'  => $this->url->link('information/information', 'information_id=' . $result['information_id'])
                );
            }
            ]]></add>
        </operation>
    </file>
</modification>
Hope this helps!
Hi there. I have ftp'd to vqmods xml folder, but I am still not seeing links in the header. Do I need to activate it somewhere? I am using version 1.5.4
Appreciate your help.
Thanks!