Re: Building page based on request?
| From: | Jon Parise | Date: | Mon, 10 Jul 2000 21:45:39 +0000 |
| Subject: | Re: Building page based on request? | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-5819@lists.php.net to get a copy of this message | ||
On Mon, Jul 10, 2000 at 02:57:30PM -0500, James Montz wrote:
> How can this be used to handle a variable number $content statements? i.e.
> a link like
>
> http://whatever.com/build.php3?content=news.php3+links.php3+files.php3
>
> And thereby inserting multiple number of include($content)?
>
> Would I have to tear apart the string, then read the variables into an
> array? Is there something simpler?
I'd do it like this ('foreach' is a PHP 4 construct):
<?php
$includes = array();
includes[] = 'some_default_page';
if (isset($content)) {
$includes = explode('+', $content);
}
foreach($includes as $file) {
include $file;
}
?>
--
Jon Parise (jon@csh.rit.edu) . Rochester Inst. of Technology
http://www.csh.rit.edu/~jon/ : Computer Science House
Member