MyBB Hacks

Full Version: How to detect location on the board? index, forumdisplay, showthread etc?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
How to detect location on the board? index, forumdisplay, showthread etc?

how can i detect the page location ?

thank you
Try

<if THIS_SCRIPT=='forumdisplay.php' then> Something</if>
Hi, thanks

I tried this but no result

Code:
<if $nav=='index.php' then>


any help please

Smile

That isnt going to work. The syntax is THIS_SCRIPT, not $nav. THIS_SCRIPT sort of says if the loaded page is one of those pages that you can see in your forum root (forumdisplay.php, member.php, showthread.php etc) then do what is inside the statement. $nav isnt one of your scripts, so THIS_SCRIPT == $nav would not work either.

Are you trying to hide the navigation on index only? Or add something to it?

If you are hiding, then you can just drop a style tag in the top of your index template. Alternatively, if you want to ADD something then see code below.

Try this in the header :

Code:
<if THIS_SCRIPT =='index.php' then>
<navigation> hello
</if>


If you add it correctly then on index ONLY the navigation has the word hello at the end of it.

Code:
<if THIS_SCRIPT =='index.php' AND 'forumdisplay.php' OR 'thread.php' then>
<navigation> hello
</if>


can i use operands? AND, OR, ||

Code:
<if THIS_SCRIPT =='index.php' OR THIS_SCRIPT =='forumdisplay.php' OR THIS_SCRIPT =='thread.php' then>
<navigation> hello
</if>


A page can't be more than one page at the same time, so AND makes no sense here.

LOL it doesnt matter if a page can be more than one page at a time Tongue

what matters is the header and footer can be delivered to more than "one" page Tongue
hey if I am in the headerinclude template

Code:
<script type="text/javascript" src="{$mybb->asset_url}/jscripts/jquery.js?ver=1800"></script>


How do i detect if its the index or forumdisplay or showthread? so i can use jquery or not just jquery?

jquery gets used a lot in MyBB. It is up to you if you want to stop loading things, and the syntax remains the same, just a lot longer.


In your headerinclude:

Code:
<if THIS_SCRIPT =='forumdisplay.php' OR 'showthread.php' then>
jquery active

<elseif THIS_SCRIPT =='index.php' then>
No jquery

<else THIS_SCRIPT =='member.php' then>
mootools
</if>

thanks, i give it a shot
Pages: 1 2
Reference URL's