By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,379 Members | 1,396 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,379 IT Pros & Developers. It's quick & easy.

Nested SSI with passed variable

P: n/a

I'm trying to implement a nested SSI file that has in it the line:

<!--#include virtual="<!--#echo var='VAR_location'-->pagelinks.txt" -->

where VAR_location is a variable set in the "calling" file. (I.e., the
original file sets VAR_location equal to a directory path, then #includes
the file in which the above line appears). I can #echo the variable
correctly from the included file, and typing the directory path explicitly
in this #include generates the correct result, but the #include directive
as written above generates "[an error occured while processing this
directive]" error. I don't know much about scripting, so there might be
some really fundamental error in my syntax with the quotes, or something.
Anyone care to enlighten me? TIA.

D.

Dennis M. Straussfogel, Ph.D.
Aerospace Engineering Consultant
Jul 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Dennis M. Straussfogel wrote:
I'm trying to implement a nested SSI file that has in it the line:

<!--#include virtual="<!--#echo var='VAR_location'-->pagelinks.txt"
-->


include directives are parsed before any script is executed on your web
server

--
William Tasso - http://WilliamTasso.com
Jul 20 '05 #2

P: n/a
In article <dm******************@news.abccom.bc.ca>, dm*@bcgroup.net
(Dennis M. Straussfogel) wrote:
I'm trying to implement a nested SSI file that has in it the line:

<!--#include virtual="<!--#echo var='VAR_location'-->pagelinks.txt" -->

where VAR_location is a variable set in the "calling" file. (I.e., the
original file sets VAR_location equal to a directory path, then #includes
the file in which the above line appears). I can #echo the variable
correctly from the included file, and typing the directory path explicitly
in this #include generates the correct result, but the #include directive
as written above generates "[an error occured while processing this
directive]" error. I don't know much about scripting, so there might be
some really fundamental error in my syntax with the quotes, or something.
Anyone care to enlighten me? TIA.


Okay, I've answered my own question. For those more neophyte than me that
might be wondering, the solution is to set an new variable in the included
file

<!--#set var="pagelinks" value="pagelinks.txt" -->

then concatenate the two variables in the #include directive (and get rid
of the #echo altogether, which I suspected didn't make sense to begin
with)

<!--#include virtual="$VAR_location$pagelinks" -->

Viola! There is probably a very simple way that experienced scripters
would use to do the concatenation without defining a new variable, but
this works.

Dennis M. Straussfogel, Ph.D.
Aerospace Engineering Consultant
Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.