Detect name of webpage you are on

How do you return the webpage you are on right now…

Checkout: parse-url

Uhm, “Name”? that’s a bit vague… do you mean the URL (if so $_SERVER contains mutliple versions of that), or the TITLE (which isn’t sent to be parsed)…

Did you mean something like this:

<?php $currentPage =  basename($_SERVER['SCRIPT_NAME']); ?>
	<li <?php if ($currentPage == 'index.php') {echo 'class="selected"';} ?>><a href="index.php">Home</a></li>
	<li <?php if ($currentPage == 'prog.php') {echo 'class="selected"';} ?>><a href="prog.php">Festival Programme</a></li>
	<li <?php if ($currentPage == 'events.php') {echo 'class="selected"';} ?>><a href="events.php">Other Events</a></li>
	<li <?php if ($currentPage == 'reports.php') {echo 'class="selected"';} ?>><a href="reports.php">Past Events</a></li>
	<li <?php if ($currentPage == 'info.php') {echo 'class="selected"';} ?>><a href="info.php">Useful Information</a></li>
	<li <?php if ($currentPage == 'contact.php') {echo 'class="selected"';} ?>><a href="contact.php">Contact</a></li>