[thelist] Re: Pass querystring to server side include

Travis tbrunn at pgmusic.com
Mon Jan 24 22:16:08 CST 2005


Hi Diane,

> You can also use a less "hard-coded" include directive:
> <!--#set var="body" value="stuff.php?${QUERY_STRING}" --> (passes a 
> query string in the URL to a php script which processes the data.)
> <!--#include virtual="${body}" --> 

That is a thing of beauty, exactly what I was looking for!

Thanks for the info, much appreciated.

-travis





----- Original Message ----- 
From: "Diane Soini" <dianesoini at earthlink.net>
To: <thelist at lists.evolt.org>
Sent: Monday, January 24, 2005 6:33 PM
Subject: [thelist] Re: Pass querystring to server side include


> On Friday, January 21, 2005, at 07:21 PM, 
> thelist-request at lists.evolt.org wrote:
> > Hi Jay
> >
> >>> <!--#include virtual="stuff.php?thisVar=foo&thatVar=bar"-->
> >
> > Yes, I was hoping it would be possible to not have fixed variables like
> > that, but to actually accept the user inputted querystring.  I know 
> > ssi has
> > a QUERY_STRING variable, but not sure if there's anyway to append it 
> > to the
> > file referenced in an include.
> >
> >>> But why use these kinds of includes when you can use PHP's include?
> >
> > Long story.  In short, user wants .htm extensions & the server guys 
> > are not
> > wanting to set things up so that .htm files are parsed for php.
> >
> 
> I try not to reply until I've caught up on all the digests, so pardon 
> if this was already answered or I don't understand your question.
> 
> First of all, you can include the output of a php script, passing any 
> query string variables either in the URL, or a post request or in the 
> include directive, as in this example.
> 
> >>> <!--#include virtual="stuff.php?thisVar=foo&thatVar=bar"-->
> 
> You can also use a less "hard-coded" include directive:
> <!--#set var="body" value="stuff.php?${QUERY_STRING}" --> (passes a 
> query string in the URL to a php script which processes the data.)
> <!--#include virtual="${body}" --> (includes the file defined by 
> variable  "body", which evaluates to something like 
> stuff.php?myvar=myval. Output of php script after processing query 
> string vars is what is included.)
> 
> <!--#set var="category" value="foo" --> Defines a variable signifying 
> which category to be highlighted.
> <!--#include 
> virtual="/includes/top_level_buttons.shtml?highlight=${foo}" --> Passes 
> that variable to the included file.
> 
> I hope that gives you some ideas.
> 
> 
> 
> -- 
> 
> * * Please support the community that supports you.  * *
> http://evolt.org/help_support_evolt/
> 
> For unsubscribe and other options, including the Tip Harvester 
> and archives of thelist go to: http://lists.evolt.org 
> Workers of the Web, evolt ! 
> 
> 


More information about the thelist mailing list