Welcome to WebmasterWorld Guest from 54.196.238.210

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Hi all, need help with something, PHP

php else etc etc

     

Acecool

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

10+ Year Member




<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

andreasfriedrich

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

WebmasterWorld Senior Member 10+ Year Member



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

Acecool

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

10+ Year Member



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?

Acecool

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

10+ Year Member



didnt work :-(

ukgimp

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

WebmasterWorld Senior Member 10+ Year Member



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

andreasfriedrich

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

WebmasterWorld Senior Member 10+ Year Member



Use elsif's

In PHP it is elseif, in Perl elsif.

ukgimp

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

WebmasterWorld Senior Member 10+ Year Member



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

Typo on my part

andreasfriedrich

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

WebmasterWorld Senior Member 10+ Year Member



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

 

Featured Threads

Hot Threads This Week

Hot Threads This Month