Closed Thread Icon

Topic awaiting preservation: More learning... (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=25874" title="Pages that link to Topic awaiting preservation: More learning... (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: More learning... <span class="small">(Page 1 of 1)</span>\

 
Ensellitis
Bipolar (III) Inmate

From: Kansas City, MO , USA
Insane since: Feb 2002

posted posted 05-27-2005 03:50

I am still in the process of learning PHP a bit more... One of my self teaching aides is this here:

code:
echo "<h1>Header</h1>";

$intro		=	"Jabber jabber jabber!!!";
$text1 		= 	"Blah blah blah!!!";
$text2 		= 	"Yadda yadda yadda!!!";

$page = $_GET['!'];
if (($page == "home") or ($page =="")) {
echo $intro;

} else if($page == "test") {
echo $text1; }

if($page == "test2") {
echo $text2;
}

echo "<h3>Footer</h3>";



What I was wondering, is there a way to make a auto navigation? Something that will take all of the $page entries and make a list for them...

:: WWW || Deviations || ThoughtPrism ::

poi
Paranoid (IV) Inmate

From: France
Insane since: Jun 2002

posted posted 05-27-2005 08:25

Sure, you can put all the possibles values of $page in an Array, and display them with a some markup around. i.e.

code:
$pagesArray = Array( "home", "test", "test2" );

echo "\n<ul id='navigation'>";
foreach( $pagesArray as $whichPage )
    echo "\n\t<li><a href='?!=". $whichPage ."'>"+ $whichPage +"</a></li>";
echo "\n</li>\n\n";

That's just one of the many ways to do this.

CPrompt
Maniac (V) Inmate

From: there...no..there.....
Insane since: May 2001

posted posted 05-27-2005 12:41

I like to use a switch function if there are many pages to call. Kind of keeps everything a little more neat.

Later,

C:\

Ensellitis
Bipolar (III) Inmate

From: Kansas City, MO , USA
Insane since: Feb 2002

posted posted 05-27-2005 16:45

POI I tried your way, and all I get is a 000... I will keep playing around and see if I can figure it out, thanks for the help =)

:: WWW || Deviations || ThoughtPrism ::

poi
Paranoid (IV) Inmate

From: France
Insane since: Jun 2002

posted posted 05-27-2005 17:47

Oops, replace the + by . in the echo
Sorry, I'm juggling between PHP, JavaScript ( client side and server side ), ... and mixed the string concatenation operator.

Ensellitis
Bipolar (III) Inmate

From: Kansas City, MO , USA
Insane since: Feb 2002

posted posted 05-28-2005 03:25

I thought the "+"s looked out of place, and I couldn't find any reference of using a + in that way on PHP.net. =)

Thanks again!!!

:: WWW || Deviations || ThoughtPrism ::

« BackwardsOnwards »

Show Forum Drop Down Menu