Welcome Guest, Not a member yet? Register   Sign In
Loading a different view in a loop according to URI segment
#1

[eluser]magikman[/eluser]
Hello everybody.

I have a list of buildings that I load from my model. Those buildings are showed in a loop within my view as so :

Controller
Code:
public function index()
{
     $data['buildings'] = $this->Base_Model->getUserBuildings();
     $this->load->view('game', $data);
}

View
Code:
<?php foreach($buildings as $b): ?>
    <div class="building">[...]</div>
&lt;?php endforeach; ?&gt;

Each build has a few "actions" possible such as "info", "price", "color". the default state shows the "info".

I want to be able to load a specific action for a specific building.

For example I have a factory and a drugstore, by default both show the "info" tab.
How to, if I click for the "price" tab of the drugstore, show the "info" tab for the factory AND the "price" tab for the drugstore ?

My URLs looks like these :

default one
Quote:site/buildings
show price of the drugstore
Quote:site/buildings/price/drugstore


Maybe I should look for a partial view solution but I really need an advise or a solution Wink

Thank you very much in advance (I apologize for my bad English too)




Theme © iAndrew 2016 - Forum software by © MyBB