PDA

View Full Version : Creating different intro text in navbar depending upon page file name


adamskis_sidefx
09-03-2009, 10:04 AM
Hi, I?ve been playing around with the layout of the navbar and have included some intro text to fill the white space. Our client has asked if it?s possible that this text could change depending upon the page you were on.

I?ve found some php script that should do the job but I am unsure how to implement it. Can someone advise me what steps I need to take to insert the following php script.

<?
$curPageName = substr($_SERVER["SCRIPT_NAME"],strrpos($_SERVER["SCRIPT_NAME"],"/")+1);
if ($curPageName == "blog.php") {
echo "This page is blog.php";
}
if ($curPageName == "memberlist.php") {
echo "This page is memberlist.php";
}
?>

Regards - Adam

Lynne
09-03-2009, 03:04 PM
In vB, you can use THIS_SCRIPT. At the top of every php page, this is defined:
define('THIS_SCRIPT', 'xxxx');

You can use that in a template like this:
<if condition="THIS_SCRIPT == 'xxxx'">
stuff
</if>

adamskis_sidefx
09-04-2009, 09:12 AM
Lynn, as ever you are a huge help. Thank you very much! :D