469,588 Members | 2,741 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,588 developers. It's quick & easy.

SSI Include dynamic URL

Hi,

I'm trying to use SSI include (platform Win XPsp2 IIS5.1)

I can do this <!--#include file="somefile.inc"-->

To get 'somefile' into my page.

What I am trying to resolve is there anyway to define the url dynamically eg

somefile_1.inc
somefile_2.inc
somefile_3.inc

I dont know enough to know whether this even achieveable.

Thanks
H
Jul 20 '07 #1
1 1866
You can do this by using a server side scripting language like ASP, ASP.net or PHP.

In ASP for instance: let's say you call the asp-file with a querystring like this:
http://www.site name.com/yourpage.asp?par=2

Put this asp code in test.asp before the <DOCTYPE ..>-declaration or else if the declaration is absent before the <head> tag of your html:

<%
Dim par
par = 0
If request.Querystring("par") <> "" Then par = request.Querystring("par") End If
%>

And then, wherever you need it:

<!--#include file="somefile_<%= par %>.inc"-->

should do it, in this case the result will be:

<!-- #include file="somefile_2.inc" -->

If the asp file is called without a querystring like
http://www.site name.com/yourpage.asp
then the result will be:

<!-- #include file="somefile_0.inc" -->
Jul 20 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

5 posts views Thread by mdawg414 | last post: by
3 posts views Thread by Buddy Robbins | last post: by
6 posts views Thread by tshad | last post: by
14 posts views Thread by Pedro Graca | last post: by
2 posts views Thread by newsgroups | last post: by
11 posts views Thread by McKirahan | last post: by
4 posts views Thread by clinisbut | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.