Welcome Guest, Not a member yet? Register   Sign In
Super Ultra Mega Dynamic Menu Post - all gurus and no gurus invited
#21

[eluser]MEM[/eluser]
Hello again Jedd,

Forgeting about the route part for now.

I have a last question regarding the two model methods Method.

The user types:
www.site.com/c_categoria/seccao/1

And the system will grab this id passed on the URI and find all parents and childs. With that returned parents and childs it will build the menu.


Another user types:
www.site.com/c_categoria/seccao/3

And the system will grab this id passed on the URI and find all parents and childs. With that returned parents and childs it will build the menu.

Another user types:
www.site.com/c_categoria/seccao/6

And it will made all process again...


Question:
Is it like this, that the data workflow will work in that case?



Regards,
Márcio
#22

[eluser]jedd[/eluser]
[quote author="MEM" date="1257030479"]
Question:
Is it like this, that the data workflow will work in that case?
[/quote]

Yup - it really is that simple.

Code:
// controller
function seccao ($thing = 'foo')  {
    if ($thing == 'foo')
          // ... handle default case of no ID being passed

    $data['parent'] = $this->Yourmodel->get_parent($thing);
    $data['children'] = $this->Yourmodel->get_children($thing);

    $this->load->view('generate_menu', $data);
    }

Filling in the details is left as an exercise for the reader Wink
#23

[eluser]MEM[/eluser]
Thanks.

I will try to fill in the blanks tomorrow, and see what I get, on my new branch. Big Grin

As a side note:
I'm quite new on understanding the power of today systems.
At the first glass, however, that seems to be quite of a processing.
Each time a user clicks a link, the database will process, the php will grab the data...
But it isn't?

I really need to understand what does, and what doesn't give systems a hard time. I'm always measuring the system work like: "If it was me, this will give me a lot of work". But I guess this is not the proper way of knowing how much a system is heavy or light.



Thanks for your time really,
Márcio
#24

[eluser]jedd[/eluser]
It's always enlightening to enable [url="/user_guide/general/profiling.html"]profiling[/url] and see how long different things take to run.

The database is rarely your bottleneck for short and sweet queries like this.

Plus, of course, you can immediately assess the performance of your design and tell if you're heading down the wrong path.
#25

[eluser]MEM[/eluser]
Thanks once again. I was looking for a "a priori" way of doing that.
But the profiling class seems amazingly helpful.

I will now dig into the code for a while, let's see if this "Mega Menu" find the end.

[]'s,
Márcio




Theme © iAndrew 2016 - Forum software by © MyBB