Re: include() with a query string?

From: Date: Fri, 02 Jul 2004 17:46:28 +0000
Subject: Re: include() with a query string?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-189555@lists.php.net to get a copy of this message
On Sat, 03 Jul 2004 03:02:07 +1000, Trejkaz Xaoza <trejkaz@xaoza.net> wrote: > > > Is there some way to fake inclusion with a query string attached? > Yep. Set the $_GET, $_POST, or $_REQUEST vars you need before including. You could also store a backup copy before doing this and put it back after the include if you need it. > I am trying to add a feature to PHP-Mesh (don't know if anyone's heard of it > or using it in these parts), basically some user discovered that they can't > have portals with query strings attached to the URL. > > Currently, portals are built something like this: > > <?php $page->apply_decorator("../portlets/test.php", "portlet"); > ?> > > The contents of the apply_decorator function look like this: > > ob_start(); > // Using require to make errors happen on failure to include a page. > require($decorator_selector->get_path($page_location)); > $page_contents = ob_get_clean(); > // The rest of this stuff's job is to decorate the page which came back. > $page = new Page($page_contents); > $decorator = $decorator_selector->get_decorator($decorator_name); > $decorator->decorate($page); > > Now, what I want to do is this: > > <?php $page->apply_decorator("../portlets/test.php?var=1", > "portlet"); ?> > > But when I do that, it can't require the page, because (obviously) the page > "test.php?var=1" doesn't exist. > > I was thinking I could use virtual() for this, but it doesn't seem to work > properly either... not even if I pass "/portlets/test.php?var=1", which I > think is a bit odd. > > Is there some workaround I can use to include a file and have it process the > query string? At the moment I'm thinking of saving $HTTP_GET_VARS, then > inserting all the variables manually and restoring the hash after the > include, but this seems to be a little more complicated than it should need > to be. > > TX > -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin--

« previous php.general (#189555) next »