Jump to content

Recommended Posts

I'm not sure it could be dumbed down much further. REQUEST_URI returns the uri that was used to access the page.

 

If I am on index.php and I click on the "Articles" tab (in the header) which has a hyperlink to "articles.php" then what would SERVER['REQUEST_URI'] hold?

 

index.php?

 

articles.php?

 

 

Debbie

 

 

Link to comment
https://forums.phpfreaks.com/topic/251027-request_uir/#findComment-1287736
Share on other sites

Whatever page you're currently on. At first it'd be index.php and then it'd be articles.php

 

I'm trying to get my hands around this code...

		<?php
			$page = basename($_SERVER['REQUEST_URI']);
			if ($page == '/') {
					$page = "index.php";
			}
		?>
		<div id="pageHeader">
			<!-- Logo -->
			<a href="index.php">
				<img id="logo" src="images/debbie_160x45.png" width="160" alt="Debbie" />
			</a>

			<!-- Top Menu -->
			<ul id="topMenu">
				<li <?php if($page=="index.php") echo 'class="current"'; ?>>
					<a href="index.php">Home</a>
				</li>

				<li <?php if($page=="article_index.php") echo 'class="current"'; ?>>
					<a href="pages/article_index.php">Articles</a>
				</li>

				<li <?php if($page=="howto_index.php") echo 'class="current"'; ?>>
					<a href="pages/howto_index.php">How-To Guides</a>
				</li>

				<li <?php if($page=="news_index.php") echo 'class="current"'; ?>>
					<a href="pages/news_index.php">In the News</a>
				</li>

				<li <?php if($page=="interview_index.php") echo 'class="current"'; ?>>
					<a href="pages/interview_index.php">Interviews</a>
				</li>
			</ul><!-- End of #TOPMENU -->
		</div><!-- End of #HEADER -->

 

 

Debbie

 

 

Link to comment
https://forums.phpfreaks.com/topic/251027-request_uir/#findComment-1287752
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.