MyBB Hacks

Full Version: custom header link only visible on threadlist
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Using the conditionals plugin, I would like to display a custom link in the header template which should only be visible on the threadlist, and possibly the thread page. Is there a variable I can use to check which page you are on?

Also - this is a seperate issue - when you are reading a thread, is there a variable available that holds the name or ID of the board the thread is in?
(03-05-2011 03:18 AM)Marc Wrote: [ -> ]Using the conditionals plugin, I would like to display a custom link in the header template which should only be visible on the threadlist, and possibly the thread page. Is there a variable I can use to check which page you are on?
Do you want to displaying the same link in the forumdisplay and the showthread?
Basically, you can try using THIS_SCRIPT

(03-05-2011 03:18 AM)Marc Wrote: [ -> ]Also - this is a seperate issue - when you are reading a thread, is there a variable available that holds the name or ID of the board the thread is in?
I think it depends on where you want to use the variable (already defined or not)
If you want to use it in showthread template, try to use $thread['fid']
(03-05-2011 04:44 AM)RateU Wrote: [ -> ]Do you want to displaying the same link in the forumdisplay and the showthread?
Basically, you can try using THIS_SCRIPT

Yes it is the same link on those pages. What script are you referring to?

(03-05-2011 04:44 AM)RateU Wrote: [ -> ]I think it depends on where you want to use the variable (already defined or not)
If you want to use it in showthread template, try to use $thread['fid']

Actually I want to use it in the header, so the variable you mention is not defined at that stage, I guess.
(03-05-2011 05:23 AM)Marc Wrote: [ -> ]Yes it is the same link on those pages. What script are you referring to?

Something like this:

Code:
<if THIS_SCRIPT == 'forumdisplay.php' || THIS_SCRIPT == 'showthread.php' then>
Your link here
</if>

I think you can use $current_page variable too.

(03-05-2011 05:23 AM)Marc Wrote: [ -> ]Actually I want to use it in the header, so the variable you mention is not defined at that stage, I guess.
If you want to put it in header template, unfortunately, yes, the $thread variable is not defined yet. But maybe you can use $style variable to get the forum id, and use forum cache to get the forum name.
Thanks, I will look into those Wink2
Reference URL's