Back to MenuManager Support

Shahiem
Shahiem

Hi,

I get the same menu on both components when I use two components on one page. How can i solve this problem?

Code

{% component 'menu' %}
{% component 'foter' %}

Thank you! ^-^

Last updated

sercanvirlan
sercanvirlan

I also need this, how can we figure out the data?

benfreke
benfreke

I'd love to know how to solve it :) I'm working on it now. I know what's going wrong but not why.

sercanvirlan
sercanvirlan

I think its NestedTree class bug ? What do you think?

benfreke
benfreke

I've pushed an update that fixes the issue.

Basically, you need to do all the plugin calculations in the onRender method not the onRun method. The added advantage of using onRender is that you can then add variables in the component call like you can with partials. I wish I'd read this section of the docs a little bit closer.

Let me know if there are any problems with this.

benfreke
benfreke

@sercanvirlan

Definitely not a NestedSet bug. If you add two blog posts to a page you can see the same issue happening, in that the components get their parameters from the last component put on the page. That plugin (the rainlab one) also uses onRun, as there is the assumption that only one component of that type will ever be written to a template. Probably a safe assumption in that plugin's case.

sercanvirlan
sercanvirlan

it works like a charm :) thanks.

Shahiem
Shahiem

Thank you man. ^-^ I had the same issue with my poll plugin.

delphinium
delphinium

I was having the same problem. Thanks so much for this post

1-9 of 9