RE: [PHP4BETA] re:array navigation

From: Date: Sat, 10 Jun 2000 14:44:34 +0000
Subject: RE: [PHP4BETA] re:array navigation
References: 1  Groups: php.version4 
Request: Send a blank email to php-version4+get-16252@lists.php.net to get a copy of this message
Isolate your file name and use associative arrays for your values. $Next[ "zero" ] = "one.htm"; $Next[ "one" ] = "two.htm"; Then use $Next[ $filename ] to get the value. Here's a function to isolate the filename (no extension), called using the "macro" for the filename (which included the path) $filename = JustFileName( __FILE__ ); function JustFileName( $pathAndFile ) { $basename = basename( $pathAndFile ); $pos = strrpos($basename, "." ); if ($pos) return substr( $basename, 0, $pos ); else return $basename; } Dan Sevush CTO Dan's Chocolates www.danschocolates.com > -----Original Message----- > From: jblythe@bold.binarylogic.com.au > [mailto:jblythe@bold.binarylogic.com.au]On Behalf Of Joseph H Blythe > Sent: Friday, June 09, 2000 1:40 AM > To: php4 > Subject: [PHP4BETA] re:array navigation > > > Hi all, > > I had an idea (wow), what i would like to do is store all the pages in > my site in an array inside an include file: > > $Nav = array( > "0" => "zero.htm", > "1" => "one.htm", > "2" => "two.htm", > "3" => "three.htm"); > > $Next = next($Nav); > $Prev = prev($Nav); > > then have links on each page and of course include the file that > contains the Nav array > > echo "<a href='$Next'>Next</a>&nbsp<a > href='$Prev'>Prev</a>"; > > and of course this doesnt work as it will always point to: > > $Next = one.htm > $Prev = zero.htm > > I have tried all sorts of thins using pos() and current() to > no success. > > has anyone every tried to do something simular to this type of > navigation, or am I just plain mad. > > Any help would be great. > > > Joseph Blythe > > -- > BoldFX / Binary Logic > 257 Churchill Road Prospect South Australia 5082 > Ph: (08) 8342 0022 Fax: (08) 8342 0155 > mailto: joseph.blythe@binarylogic.com.au > > > > > -- > PHP 4.0 Beta Mailing List <http://www.php.net/version4/> > To unsubscribe, e-mail: php4beta-unsubscribe@lists.php.net > For additional commands, e-mail: php4beta-help@lists.php.net > To contact the list administrators, e-mail: > php4beta-admin@lists.php.net >

« previous php.version4 (#16252) next »