[eluser]jcjc[/eluser]
I'm passing $data into a view on each page and have an autoload in place. Before the view I have the following:
Code:
$data['category'] = $this->productModel->listCategories();
I'm trying to find a way where I don't have to have this on each page view controller. I've tried placing the code inside the header.php template but I get undefined variable category.
Inside the header template I have:
Code:
<?php foreach ($category as $cat) : ?>
<li><a href="/products/<?php echo url_title($cat->ProductCategory, '-', TRUE); ?>"><?php echo $cat->ProductCategory; ?></a></li>
<?php endforeach; ?>
Totally stumped!
In short, I need it to run on every page as it's in the header.