Jump to content

PHP running under CGI help


yuckysocks

Recommended Posts

Hi,

 

I want to make a simple script that changes a menu's style based on what the active page is. the code I have now is thusly:

 

<?php $currentPage = basename($_SERVER['SCRIPT_NAME']); ?>
		<ul>
			<li><a href="index.php" <?php if ($currentPage == 'index.php') {echo 'id="here"';} ?>>Exchange Home</a></li>
			<li><a href="nechps.php" <?php if ($currentPage == 'nechps.php') {echo 'id="here"';} ?>>Northeast......

 

I've tried one-line scripts that read either:

<?php echo basename($_SERVER['SCRIPT_FILENAME'], '.php'); ?>

 

or

 

<?php echo basename($_SERVER['SCRIPT_NAME']); ?>

 

to define the variable, but both simple scripts return "php.cgi". I know that this means my server is running php via cgi... is there a workaround to gain similar functionality?

 

Alex

Link to comment
https://forums.phpfreaks.com/topic/88759-php-running-under-cgi-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.