I have a links section on my website that is sitewide but I would like to only display various external links depending on the page the person is on rather than having a bunch of sitewide links. Would someone kindly tell me some PHP code that allows me to do this? This is my site, the links section is at the bottom left.
You can store various links that are associated with the specific page, then load them based on the url being requested. Check the $_SERVER variables to find out which page the browser has requested.
Well you can try something like: if($page = "home") { //display home links } if($page = "about") { //display about page links } PHP: and so on ... ? That help?
Maybe something as such: <? if($_SERVER['REQUEST_URI'] == "/index.php") { echo "links for homepage"; } if($_SERVER['REQUEST_URI'] == "/about.php") { echo "links for about.php"; } ?> PHP: