XF 2.2 Setting navigation ID for controller view

CedNet

Member
I've created a simple controller with a view.

Right now displays the _default menu ("no selected tab").

I want it to show the forums navigation menu.

What is the parameters I should pass to the view to have it show the forum section / sub links?
 
Set the section context in the route to your controller to the corresponding navigation ID.
 
Yes, finally google and found the answer.

Why is there no documentation showing all the possible parameters or view options?

For everyone else, this is the answer:

$this->setSectionContext('forums');
 
For everyone else, this is the answer:
While that method will work, it's generally reserved for overriding the section context in specific situations. For example, when different controller actions need different section contexts. In general, all that should be necessary is setting the corresponding context entry within the route:

1611443362000.png
 
While that method will work, it's generally reserved for overriding the section context in specific situations. For example, when different controller actions need different section contexts. In general, all that should be necessary is setting the corresponding context entry within the route:

View attachment 244738

Thx for taking time to answer.

Specifically what I have done is making a controller with as little context as possible. It's basically a view with nothing in it.

The purpose of this view is to act as an empty template (to be rendered as fast as possible) that I parse into the main website framework that is currently laravel. I use this view as to get the raw JS files and nav tree for use outside of the forum.

I can't create a custom route. If that is what you're suggesting?

Im very new to Xenforo however want to become as knowledgable as possible about it. And how to do things the right way.
 
I can't create a custom route. If that is what you're suggesting?
How are you executing the controller action to render the view? Depending on what you're trying to accomplish and how, manually setting the section context might be appropriate then. Though if it pertains to rendering templates outside of XF, there might be a better way to accomplish that.
 
Back
Top Bottom