Welcome Guest, Not a member yet? Register   Sign In
CI Views / Structure question
#1

[eluser]shaffick[/eluser]
I am just wondering how the rest of the community handles the following:

Quote:You need to display a banner or a block of content on EVERY page of your site.

Currently, I have the banner code in the __construct part of the controller and assign it to:

Code:
$this->variable = $this->blabla_model->get_banner_info_now_please();
and pass it on to the final view() call in every other controller function. The banner html is in the my_final_template.php

Thoughts or improvement on how to handle this?

Thanks
shaffick
#2

[eluser]bubbafoley[/eluser]
do it like this and the varaibles will be available in all of your views

Code:
$data['var1'] = $this->blabla_model->get_banner_info_now_please();
$this->load->vars($data);

then in your view it's just:
Code:
<?php echo $var1 ?>




Theme © iAndrew 2016 - Forum software by © MyBB