Welcome Guest, Not a member yet? Register   Sign In
Load Query on every Page - How To?
#1

[eluser]breastfed[/eluser]
Hello

i got a controller "cars".
With the function() "brand" i want to select all entries with the matching brand. An example URL is: .com/cars/brand/ford or .com/car/brand/chevrolet

Now the URL .com/cars/brand/xxx is in my Mainnavigation, on every Page.
So i want to query on every Page all items from the table "brands" and run a foreach() to create my navigation. Where do i put the Query? In the View? In a Controller - which Controller?

Would be happy to get some help.

Thanks!
#2

[eluser]InsiteFX[/eluser]
Put your query in a model, load the model and call the query in your index method.
assign it to $data array and pass it to your view.

If you call it once and want it on every view then use this:
Code:
$this->load->vars($data);
$this->load->view('view_name');

InsiteFX
#3

[eluser]breastfed[/eluser]
Call it in every index() method of each controller?
I got a main Template where i want to inlcude this Query. The View of a Controller is loaded into the Template and not in to the whole page View.


Thanks!
#4

[eluser]breastfed[/eluser]
I think i am wrong here in Reactor.
Post in Core now - please close or delete.




Theme © iAndrew 2016 - Forum software by © MyBB