Jump to content


Photo

PHP Newbie Question


  • Please log in to reply
4 replies to this topic

#1 Eric123

Eric123
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 02 March 2006 - 10:11 PM

I have a file called community.php i want to say that if the current file being executed is community.php to echo something. This also must work if the file is community.php?id=4 etc. Anyone know, if so thanks so much.

#2 dcro2

dcro2
  • Members
  • PipPipPip
  • Advanced Member
  • 489 posts

Posted 02 March 2006 - 10:33 PM

If you are running community.php then why do you want to check if you're running community.php?


#3 Eric123

Eric123
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 02 March 2006 - 10:36 PM

[!--quoteo(post=351138:date=Mar 2 2006, 05:33 PM:name=dcro2)--][div class=\'quotetop\']QUOTE(dcro2 @ Mar 2 2006, 05:33 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
If you are running community.php then why do you want to check if you're running community.php?
[/quote]

becuase the file i want to put the code in is beiing inlcuded in community.php. It's difficult to explain. But basically i want to say that if the pae is community.php to change the menu image, otherwise leave it the way it is.

#4 willpower

willpower
  • Members
  • PipPipPip
  • Advanced Member
  • 296 posts
  • LocationWarrington, Cheshire, UK

Posted 02 March 2006 - 10:51 PM

All I would do is declare a variable in the file:

comunnity.php

$community="yes"

Then in the included file

if ($community=="yes") {do this} else {do this}

Will
Wait...I've got it...Bollocks, it's gone again!

If at first you don't succeed....stop using ASP and get onto PHP

#5 Eric123

Eric123
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 02 March 2006 - 11:06 PM

[!--quoteo(post=351146:date=Mar 2 2006, 05:51 PM:name=willpower)--][div class=\'quotetop\']QUOTE(willpower @ Mar 2 2006, 05:51 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
All I would do is declare a variable in the file:

comunnity.php

$community="yes"

Then in the included file

if ($community=="yes") {do this} else {do this}

Will
[/quote]
It works, but when I go to anything else which contains the page i put that code in a get an error.

On my page i have my menu and in my menu i have include menuhome.php.. in menuhome.php i have the image and the link for the menu. So any page i view includes menuhome.php.

[a href=\"http://24.36.100.97/main/community.php\" target=\"_blank\"]http://24.36.100.97/main/community.php[/a]




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users