Welcome to WebmasterWorld Guest from 54.147.236.192

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Hi all, need help with something, PHP

php else etc etc

     
6:44 am on Jan 7, 2003 (gmt 0)

New User

10+ Year Member

joined:Dec 10, 2002
posts:24
votes: 0



<h3><?echo ("$page")?></h3>
and top menu
<p>
<?php
if(!@include("website/games/Atari/$review.php")
)
IF ELSE {
if(!@include("website/games/Atari/$walkthrough.php")
)
{
include("website/games/info/Atari.php");
}}
?>
<p>
and bottom menu

Well Im confused ORiginal code is


<h3><?echo ("$page")?></h3>
and top menu
<p>
<?php
if(!@include("website/games/Atari/$walkthrough.php")
)
{
include("website/games/info/Atari.php");
}
?>
<p>
and bottom menu

I want to know how i can add another else
so

if somone goes to index.php?page=Atari (working)
that it will show the info "website/games/info/Atari.php"

IF somone goes to index.php?page=Atari&walkthrough=gamename

info isnt shown, but that page is

index.php?page=Atari&review=gamename

if they go there, info isnt shown, game review is shown

if they try index.php?page=Atari&review=gamename&walkthrough=gamename it shows info because i dont want it to show 2 on page

Well I hope im clear enough, Thanks

1:07 pm on Jan 7, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:July 22, 2002
posts:1782
votes: 0


I want to know how i can add another else

Have a look at php.netīs documentation for elseif [php.net] and else [php.net].

BTW you might want to think about changing your URIs to a more SE friendly format.

Andreas

1:24 pm on Jan 7, 2003 (gmt 0)

New User

10+ Year Member

joined:Dec 10, 2002
posts:24
votes: 0


Thanks for the reply,
I actuatly like this format because if someone tries to download my site with any download tool, they get a huge mes jumble index.php.htm

anyway the main site/news etc is index.php if I have the meta in there then it should be fine, or?

1:39 pm on Jan 7, 2003 (gmt 0)

New User

10+ Year Member

joined:Dec 10, 2002
posts:24
votes: 0


didnt work :-(
2:07 pm on Jan 7, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Dec 6, 2001
posts:2213
votes: 0


Ace

Dont worry about someone downloading your site. They wont see anything but html. PHP is processed server side. The only way someone will realistically be able to download your site is with ftp access.

If you want to get along with any scritping language write "readable" code. You need to be able to see where you have been and what you have been doing. If you produce an epic bit of code, how are you going to ammend that later. Use comments and structure it you will thank yourself.

Use elsif's

Cheers

2:37 pm on Jan 7, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:July 22, 2002
posts:1782
votes: 0


Use elsif's

In PHP it is elseif, in Perl elsif.

2:39 pm on Jan 7, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Dec 6, 2001
posts:2213
votes: 0


Good spot Andreas, but I expect nothing less form the php guru :)

Typo on my part

2:45 pm on Jan 7, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:July 22, 2002
posts:1782
votes: 0


Brett should add some code highlighting features to this board. ;)

I often confuse those little syntax differences but XEmacs always helps me figure them out really fast. If the color does not change then it is the wrong syntax.

Andreas