Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Dynamic Includes
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Dynamic Includes

 Post Reply Post Reply Page  12>
Author
FatOtis View Drop Down
Newbie
Newbie


Joined: 20 April 2003
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote FatOtis Quote  Post ReplyReply Direct Link To This Post Topic: Dynamic Includes
    Posted: 12 June 2003 at 6:47am

Having found out that I can't use variables for dynamic includes using the   <!--#INCLUDE file="<% =var %>"-->   method I decided to go looking up dynamic include script on the net, I found a few of sample scripts but havent had any luck getting anything to work, can anyone help me with this?

Back to Top
stephen View Drop Down
Newbie
Newbie


Joined: 23 August 2002
Location: United Kingdom
Status: Offline
Points: 33
Post Options Post Options   Thanks (0) Thanks(0)   Quote stephen Quote  Post ReplyReply Direct Link To This Post Posted: 12 June 2003 at 7:55am

http://www.4guysfromrolla.com/webtech/010700-1.shtml

Server.Execute "pagename.asp" Could work as well.

also if there are say two possible values for varaiable var, u could try:

<% If var = "one" Then %>

<!--#INCLUDE file="firstpage.asp"-->

Else

IF var = "two" Then %>

<!--#INCLUDE file="secondpage.asp"-->

End if

End if

where firstpage.asp and secondpage.asp contain the asp code for the variabls. Actually in this case, it's best to use select Case statements.

Back to Top
ultramods View Drop Down
Groupie
Groupie
Avatar

Joined: 08 January 2003
Location: Scotland
Status: Offline
Points: 146
Post Options Post Options   Thanks (0) Thanks(0)   Quote ultramods Quote  Post ReplyReply Direct Link To This Post Posted: 12 June 2003 at 8:25am

Or you could use:

server.execute("yourPage.asp")

Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post Posted: 12 June 2003 at 10:09am
He is asking for a variable you cant use <%server.execute(var1)%> it causes an error...
Back to Top
FatOtis View Drop Down
Newbie
Newbie


Joined: 20 April 2003
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote FatOtis Quote  Post ReplyReply Direct Link To This Post Posted: 12 June 2003 at 10:15am

Yer basically, what I'm trying to do is make my site skinable, if you know any other methods please let me know.

Basically how I want it to work is:

varSkin = Read SkinName from cookie

Include header called varSkin

Back to Top
stephen View Drop Down
Newbie
Newbie


Joined: 23 August 2002
Location: United Kingdom
Status: Offline
Points: 33
Post Options Post Options   Thanks (0) Thanks(0)   Quote stephen Quote  Post ReplyReply Direct Link To This Post Posted: 13 June 2003 at 3:10am

FatOtis doesn't this method work

<%

var1 =Request.Cookies("Skin")("value")

server.execute("skinFile.asp?type=var1")

%>

?



Edited by stephen
Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 13 June 2003 at 1:09pm

Of course you can use variables in server.execute something like
var1 = "folder/file.asp"
Server.Execute var1
would work.
Anyway, I don't think server.execute would work would for skins and the option stephen supplied first may take up quite a bit of space, as all code would be processed. You could store the actual code in a database and just print the code needed for your skin or use some component that does real dynamic includes.

Back to Top
FatOtis View Drop Down
Newbie
Newbie


Joined: 20 April 2003
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote FatOtis Quote  Post ReplyReply Direct Link To This Post Posted: 14 June 2003 at 5:00am
Yea, I'll have a fiddle around and see what happens, thanks for the help guys.
Back to Top
 Post Reply Post Reply Page  12>

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.