avoiding redundancy |
[eluser]belbek[/eluser]
suppose in one controller 'shop' I have 3 functions 'item1,2,3' each of them gives to view file information about 3 items: http://localhost/shop/item1,2,3 and I need a block wich will show information about 4th item and it should be placed on every page together with 3 previous items. how to avoid redundancy and not to place information about 4th item in each of 1-3 functions?
[eluser]Randy Casburn[/eluser]
in the __controller() do.. Code: $fourthviewdata = array('stuff'=>'my fourth view data'); Then in 1,2,3 load your views with fourth Code: $this->load->view('firstview',$this->data); then in your 1,2,3 views do Code: <?=$fourth_item_view?> where you want the block --- There you have it, Randy
|
Welcome Guest, Not a member yet? Register Sign In |