![]() |
|
Thread Tools |
#1
|
||||
|
||||
![]()
When it comes to highlighting the active page in a navbar I find myself using if conditions, just what I've grown accustomed to.
Example: (may not be perfect, just going from the top of my head)
I was wondering to avoid the multiple if's, is their an easier way (or better way) for achieving this concept? I'm asking here rather than on stack because we are vBulletin users, and a lot of stack members tend to have issues with vb lol, and maybe vb has a whole different way of detecting the current page.
__________________
If you need custom work done please use Dirt RIF CustUmz Owner of vBTeam vBulletin 3.8.14 DRC Edition PHP 7.4 Compatible- NOT a null, NOT complete files Requires a legit copy of vBulletin 3.8.11. No members have liked this post.
|
#2
|
||||||||
|
||||||||
Change
To
__________________
Donations always appreciated. ![]() vByilmaz.com vBulletin-forum.de Nobody has a monopoly on vBulletin templates. Stay away from selfish, self-righteous and parasitic. No members have liked this post.
|
#3
|
||||||||
|
||||||||
Originally Posted by yilmaz
isn't that vb 4 vb statement ?
![]()
__________________
Android Custom Creations ![]() No members have liked this post.
|
#4
|
||||||||||||||||
|
||||||||||||||||
Originally Posted by yilmaz
no no no lol, I'm sorry if I wasn't clear its not about vb3 or vb4. It's about coding in general. I'm wondering if there is a better approach to detecting which page I am on, rather than having to use an if condition for each link.![]()
I got to thinking a jQuery solution, I may add classes based on links. It would look something like:
Which I'm thinking will be way better than a bunch of if conditions. it would turn that top piece of code into:
Which is much easier to work with rather than having a bunch of ifs as for the link we want styled if its not the current page, add its own class to it, and tell jQuery to remove it if it is the current page.
__________________
If you need custom work done please use Dirt RIF CustUmz Owner of vBTeam vBulletin 3.8.14 DRC Edition PHP 7.4 Compatible- NOT a null, NOT complete files Requires a legit copy of vBulletin 3.8.11. No members have liked this post.
|
#5
|
||||
|
||||
Sorry, I replied as the topic is in the vb4 section.
__________________
Donations always appreciated. ![]() vByilmaz.com vBulletin-forum.de Nobody has a monopoly on vBulletin templates. Stay away from selfish, self-righteous and parasitic. No members have liked this post.
|
#6
|
||||
|
||||
It was more a coding in general type of question, maybe should have posted in private coders, but i feel this section gets the most viewers lol.
It's something that could be applied too ANY vb version though.
__________________
If you need custom work done please use Dirt RIF CustUmz Owner of vBTeam vBulletin 3.8.14 DRC Edition PHP 7.4 Compatible- NOT a null, NOT complete files Requires a legit copy of vBulletin 3.8.11. No members have liked this post.
|
#7
|
||||||||
|
||||||||
Originally Posted by Dr.CustUmz
This is the most logical.![]()
Note: Maybe you know, you should always specify the name of that file first in the custom php page. custom.php
__________________
Donations always appreciated. ![]() vByilmaz.com vBulletin-forum.de Nobody has a monopoly on vBulletin templates. Stay away from selfish, self-righteous and parasitic. No members have liked this post.
|
#8
|
||||
|
||||
so using if conditions is the way you would do? It just felt like too much, and I got to thinking of alternative ways lol
__________________
If you need custom work done please use Dirt RIF CustUmz Owner of vBTeam vBulletin 3.8.14 DRC Edition PHP 7.4 Compatible- NOT a null, NOT complete files Requires a legit copy of vBulletin 3.8.11. No members have liked this post.
|
![]() |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Add-On Releases Navbar Mod - adds social bookmarking, notifications highlighting, & search fields | vbboarder | vBulletin 3.7 Add-ons | 32 | 09 Mar 2012 05:08 |
Add-On Releases Navbar - adds social bookmarking, notifications highlighting, & search fields | vbboarder | vBulletin 3.8 Add-ons | 41 | 30 Nov 2009 05:51 |
«
Previous Thread
|
Next Thread
»
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
|
|
New To Site? | Need Help? |
All times are GMT. The time now is 04:36.