Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

If else function - but not based on id 1

Status
Not open for further replies.

sinbadly

Technical User
Mar 16, 2006
126
GB
I need to call an image from homepage (default.php) and from pages within.

Normally, I use if id='something', but this time I need to say if the page is the default page ...

Be grateful to know how I would name the default page rather than an ID, like this -

if($_GET['id'] == '' OR $_GET['id'] == 0)
{
echo '<img src="images/sept/al.gif" title="We want writers and artists!">';
}
elseif($_GET['id'] >= 1 )
{ echo '<img src="../images/sept/al.gif" title="We want writers and artists!">';
}
 
if (!isset($_GET['id'])) {......}

I believe this allows for a case of an empty GET string, or at least no value for "?id="



D.E.R. Management - IT Project Management Consulting
 
Thanks, thedaver, but the homepage doesn't have an id number and nor do many of the pages within, that's the trouble.

Wouldn't I have to code something like

if($_GET['page or something'] == 'default.php or something' )

? Cheers
 
What it does, thedaver, is certainly to allow the image to appear on each page, only it duplicates it.

So obviously you have put me on the right track, and many thanks. I'll have a fiddle with it tonight. Cheers
 
what about
Code:
if (basename(__FILE__) === "default.php"){
 //put default image up
}else{
 //put some other image up
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top