Arrays
| From: | Ashley M. Kirchner | Date: | Fri, 26 Oct 2001 08:17:49 +0000 |
| Subject: | Arrays | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-72411@lists.php.net to get a copy of this message | ||
I'd like to create an array of "available resources", and be able to
check it every time. What I'd like to do is something like;
$site = array( "section1" => #, "section2" => #, etc.. )
where "section*" is a STRING variable and # is an INT (if it's even
possible to do that)
Once I have this setup properly, I'm going to have a routine that
extracts data from PATH_INFO, namely '$section' and '$page' which should
then be checked against the array:
- if $section exists in the array
- if $page is less or equal to the INT value in that $section
do something with $page (or just break out of the routine)
- else
default to 1 (and break out)
- else
default to something like main, or whatever, and set $page to 1
These values will then be used in a template to read in the proper
files through <? include $section$page."inc"; ?>
I don't know whether I can create an array of STR => INT values, and
I don't know where to start with the function needed to traverse that
array once I have information from PATH_INFO (of course, this is
depending on PATH_INFO even passing along valid information)
--
H | "Life is the art of drawing without an eraser." - John Gardner
+--------------------------------------------------------------------
Ashley M. Kirchner <mailto:ashley@pcraft.com> .
303.442.6410 x130
Director of Internet Operations / SysAdmin . 800.441.3873 x130
Photo Craft Laboratories, Inc. . 3550 Arapahoe Ave, #6
http://www.pcraft.com ..... . . . Boulder, CO 80303,
U.S.A.