Post by ianmac » Mon Oct 05, 2009 7:32 pm

Hi all

I would like to use the information list in the main layout.
would do I go about doing this.

I have experience with php but not cake do I need to create a new controler
any help with this would be great thanks.

mac

Newbie

Posts

Joined
Mon Oct 05, 2009 7:21 pm

Post by Qphoria » Mon Oct 05, 2009 8:09 pm

This isn't cake based.. its more like code igniter, but only in part.

Anyway, your question is a simple html one.

Edit catalog/view/theme/default/template/module/information.tpl file
After the foreach loop. you can add your own simple <a.... </a> links

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by ianmac » Tue Oct 06, 2009 1:16 am

thanks for the reply Qphoria

sorry but the vague question.

I have realised that its is not the layout template file that I need to display the information
links but the head template.

this there a why to load the information model into the header controler so I can accesss the
informtion link from the database.

thanks again

Mac :)

Newbie

Posts

Joined
Mon Oct 05, 2009 7:21 pm

Post by ianmac » Tue Oct 06, 2009 4:34 am

sorted it

just in case anyone else wants to do something similar

you will need to add the information module to the header.php file in
catalog/controller/common/header.php

here is the code

Code: Select all

$this->load->model('catalog/information');
you will also have to get the information results from the database

Code: Select all

		foreach ($this->model_catalog_information->getInformations() as $result) {
      		$this->data['info_links'][] = array(
        		'title' => $result['title'],
	    		'href'  => $this->model_tool_seo_url->rewrite($this->url->http('information/information&information_id=' . $result['information_id']))
      		);
    	}

now in the header.tpl file in
catolog/view/theme/default/template/common/

Code: Select all

<ul>
  <?php foreach ($info_links as $information) { ?>
  <li><a href="<?php echo $information['href']; ?>"><?php echo $information['title'];?></a></li>
  <?php } ?>
</ul>
hope this will save someone a bit time :)

Newbie

Posts

Joined
Mon Oct 05, 2009 7:21 pm
Who is online

Users browsing this forum: No registered users and 7 guests