Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Random includes
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Random includes

 Post Reply Post Reply
Author
JDYoung View Drop Down
Newbie
Newbie
Avatar

Joined: 19 November 2002
Location: United States
Status: Offline
Points: 20
Post Options Post Options   Thanks (0) Thanks(0)   Quote JDYoung Quote  Post ReplyReply Direct Link To This Post Topic: Random includes
    Posted: 15 September 2003 at 11:37am

Is it possible to have random includes?  If I have three different pages, is it possible to have it randomly select one of the three pages?

 

 

Thank you,



Edited by JDYoung
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: 15 September 2003 at 3:19pm
Theoretically yes, you can use includes in your randomize function though all pages get always included, no matter what. You can put the content in a db field and query it that way.
Back to Top
JDYoung View Drop Down
Newbie
Newbie
Avatar

Joined: 19 November 2002
Location: United States
Status: Offline
Points: 20
Post Options Post Options   Thanks (0) Thanks(0)   Quote JDYoung Quote  Post ReplyReply Direct Link To This Post Posted: 15 September 2003 at 3:29pm
I am not sure I really unstand.
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: 16 September 2003 at 9:56am

Dim randomstring

Randomize

randomstring = INT(rnd()*10)

Do While randomstring > 3

randomize

randomstring = INT(rnd*10)

Loop

randomstring = "page" & randomstring & ".asp"

server.execute randomstring



Edited by Mart
Back to Top
JDYoung View Drop Down
Newbie
Newbie
Avatar

Joined: 19 November 2002
Location: United States
Status: Offline
Points: 20
Post Options Post Options   Thanks (0) Thanks(0)   Quote JDYoung Quote  Post ReplyReply Direct Link To This Post Posted: 16 September 2003 at 4:04pm

Thank you.  I am still a but unsure how this code is put into a page and unsed.  I have my main page & would like to randonmly include 1 of the 3 files (a header ) into the main page.

So would I insert your code into the main page where I want one of the random <!--#include virtual="includes/header.asp" --> files to be place?

Thank you again!

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: 17 September 2003 at 7:55am
Mart is using Server.Execute which has the advantage of using variables as a filename, that luxury you don't have with SSI includes. Just put his code to wherever you want the page to be executed.
Back to Top
 Post Reply Post Reply

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.