SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    Keep Moving Forward gold trophysilver trophybronze trophy
    Shaun(OfTheDead)'s Avatar
    Join Date
    Nov 2005
    Location
    Trinidad
    Posts
    3,727
    Mentioned
    43 Post(s)
    Tagged
    0 Thread(s)

    Case Include... Syntax??

    Hey.

    I'm trying to put together that standard case include method of building websites in ASP. The variable for the ASP switch comes from a query string.

    Code:
    <%
    Select Case Request.QueryString("page")
    	case "home"
    		<!--#include file = "content/home.inc"-->
    	end select
    %>
    It isn't working, though... do you guys spot a syntax error or something??

  2. #2
    SitePoint Zealot yacka's Avatar
    Join Date
    Aug 2006
    Posts
    124
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You might need a colon after "home".

  3. #3
    Keep Moving Forward gold trophysilver trophybronze trophy
    Shaun(OfTheDead)'s Avatar
    Join Date
    Nov 2005
    Location
    Trinidad
    Posts
    3,727
    Mentioned
    43 Post(s)
    Tagged
    0 Thread(s)
    Hello all !!

    I've managed to dig up an old website I made in January that had the correct syntax (I was stuck in work when I started this thread so I didn't have my old files handy).

    Anyways... I figure I'll post it here in case anyone in future's searching the forum for something like it...


    Code:
    <%
    Dim whichpage
    whichpage = Request.QueryString("SSI")
    Select Case whichpage
    Case "who_we_are"
    %>
    <!-- #include file="../content/1_who_we_are.ssi" -->
    <% Case "mission_statement" %>
    <!-- #include file="../content/1_mission_statement.ssi" -->
    <% Case "our_values" %>
    <!-- #include file="../content/1_our_values.ssi" -->
    <% Case "company_history" %>
    <!-- #include file="../content/1_company_history.ssi" -->
    <% Case Else %>
    <!-- #include file="../content/1_who_we_are.ssi" -->
    <%End Select%>
    Apparently my mistake was that the include statements had to be outside the lil <% %> thingys.

    I think my problems should be solved when I try at it again tomorrow.

    Thanks for your suggestion, yacka.

  4. #4
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,609
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Remember that all those include files will be included anyway (#include is acted on before any ASP coding) thus any code in those files will be included, but the Select Case will then determine what gets sent to the browser.
    Ian Anderson
    www.siteguru.co.uk

  5. #5
    ALT.NET - because we need it silver trophybronze trophy dhtmlgod's Avatar
    Join Date
    Jul 2001
    Location
    Scotland
    Posts
    4,836
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    As siteguru said, the include files are included within the ASP file BEFORE it hits the ASP interpreter. This can cause some problems if you don't understand this (not that I'm you don't).

    What I have seen before when consulting is people including HUGE files on EVERY page that aren't needed, but thought if...end if statements wouldn't include them (ie. more needless overhead). I've always recommended looking into the Server.Execute() function instead. This cuts down the amount of unnecessary code loaded, and cuts down the number of times the interpreter has to stop parsing the ASP (entering/exiting <% %> tags has performance overhead).

    It's been 3-4yrs since I've actually written any ASP, I could be remembering wrong, but I don't think I am...


  6. #6
    Original Gangster silver trophy Thing's Avatar
    Join Date
    Oct 2000
    Location
    Philadelphia, PA
    Posts
    4,708
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by dhtmlgod
    It's been 3-4yrs since I've actually written any ASP, I could be remembering wrong, but I don't think I am...
    Has it been that long already? Those were the good ol days!

    No your correct. This is actually how our intranet was originally created at work. It loads about 15,000 lines of code just to bring up the menu and is ridiculously slow!

  7. #7
    Keep Moving Forward gold trophysilver trophybronze trophy
    Shaun(OfTheDead)'s Avatar
    Join Date
    Nov 2005
    Location
    Trinidad
    Posts
    3,727
    Mentioned
    43 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by dhtmlgod
    I've always recommended looking into the Server.Execute() function instead. This cuts down the amount of unnecessary code loaded, and cuts down the number of times the interpreter has to stop parsing the ASP (entering/exiting <% %> tags has performance overhead).
    Interesting.

    I'm actually really new to ASP, so I'm pretty much fumbling my way through it (aka... copying and pasting from other people's code). I'll look into this when I get some time, thanks.

  8. #8
    ALT.NET - because we need it silver trophybronze trophy dhtmlgod's Avatar
    Join Date
    Jul 2001
    Location
    Scotland
    Posts
    4,836
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Shaun(OfTheDead)
    Interesting.

    I'm actually really new to ASP, so I'm pretty much fumbling my way through it (aka... copying and pasting from other people's code). I'll look into this when I get some time, thanks.
    Learn ASP.NET instead

    Thing: I know! I remember when it was all full of posts, as far as the eye could see!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •