Dynamic Navbar Link

viaBowl

Member
Here's one I'm stumped on:

Where is the BEST place to put a custom function that will return a user-unique URL that will be placed in the navbar.

Basically, I am going to add my navbar link in the template, but I want to use a callback to generate the href.

Any advice is appreciated :)
 
Use the <xen:callback> tag wherever you want in a template. The callback tag receives the name of the class that should be called. For example, a class name could be

YourCompany_CallBacks_YourClass


The actual class file should be places inside the library directory with the same directory structure as the name of the class you are calling on the callback tag:

YourCompany/CallBacks/YourClass.php

Read more about it here: http://xenforo.com/community/resources/xen-callback-tag.2027/
 
I just discovered this after I posted. The direct callback from a template is awesome! I wonder how resource heavy it would be for bigger calls.
 
You can always implement some sort of caching system if your callbacks are big enough to worry about them.
 
Back
Top Bottom