Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.