FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


special formatting for the link i'm in.





guissmo
How do I make a link in PHP such that when for example, it links to the page I'm in, it changes into a different formatting. I'm not sure if this is PHP or CSS but yeah.
badai
this is a bit tricky. the only way i see is, on every page have a php or javascript variable with tha page name as it's value.

then use php or javascript to get the current page

php: substr($_SERVER["SCRIPT_NAME"],strrpos($_SERVER["SCRIPT_NAME"],"/")+1);

javascript: window.location.pathname.substring(window.location.pathname.lastIndexOf('/') + 1);

compare it with your variable, then set the style DOM of your link.

every time you rename your file, don't forget to change the variable value.

unless, someone have better idea?
jmraker
You can run some javascript on every page load like, it works in firefox at least
Where it makes matching links have the class "ThisPage", if it already has a class, it'll get replaced

Code:
for(link in document.links){
  if(document.links[link] == document.location.href){
    document.links[link].className = "ThisPage";
  }
}
Related topics
Site Nav Suggestions...
convert ur PDF files to word documents
Installing, Partitioning & Formatting HDDs
Free Online Games (Do not make more new threads about this)
Master Tutorial on SEO
Questions about best image formatting...
Link exchange with a web design company website
Acer eRecovery
bf 2142/bf2 DKElite changes to Danish Special Force
should we care about antartic ice melting?
Google's new privacy link
Formatting and reinstalling a laptop os
Collected Web shortcuts to link index HTML
Acronis True Image 10 for Free
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.