[thelist] Re: Pass querystring to server side include
Diane Soini
dianesoini at earthlink.net
Mon Jan 24 20:33:02 CST 2005
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.
More information about the thelist
mailing list