Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

ASP... Nested select

Options
  • 11-02-2004 5:58pm
    #1
    Registered Users Posts: 771 ✭✭✭


    Ive got a simpleish ASP problem.

    Let's pretend that i've got 10 destinations
    New york, London... etc.

    And Ive got 3 Irish airports,
    Dublin Cork and Knock.
    (I already store the irish airports in a session variable)

    I want to create a page that prints out flight timetables
    (a seperate file to be included)
    based on the session and a query string. Also

    So i had

    <%
    select case request.QueryString("Destination")

    case "London"
    case "NY"
    etc...

    end select
    %>

    Then within these select case's i'd have another select case
    based on The session variable so i'd have something like

    <%
    select case request.QueryString("Destination")

    case "London"

    select case request.session("airport")
    case "Cork"
    %>
    <!--#include virtual="/timetables/CORKLONDON.asp"-->
    <%
    case "Knock"
    %>
    <!--#include virtual="/timetables/KNOCKLONDON.asp"-->
    <%
    case else
    %>
    <!--#include virtual="/timetables/DUBLINLONDON.asp"-->
    <%
    end select

    case "NY"

    select case request.session("airport")
    case "Cork"
    case "Knock"
    case else '''
    end select
    etc...

    end select
    %>


    So im wondering if these nested select cases are allowed.
    I don't think they are because I am getting an error saying
    that the include file cannot be found.

    <!--#include virtual="/timetables/CORKLONDON.asp"-->

    even if im looking at the DUBLIN site,
    i.e. with the dublin session loaded.


    do you know what i mean? :(


Comments

  • Moderators, Politics Moderators Posts: 39,950 Mod ✭✭✭✭Seth Brundle


    does <!--#include file="/timetables/DUBLINLONDON.asp"--> with a realtive path from the current file?


  • Registered Users Posts: 771 ✭✭✭whiteshadow


    does <!--#include file="/timetables/DUBLINLONDON.asp"--> with a realtive path from the current file?

    not sure i understand the question!?

    it includes the file from the root directory
    so from www.whatever.com/


  • Closed Accounts Posts: 156 ✭✭JJSolutions


    or use

    server.execute "/timetables/CORK...."

    Asuming you are not sharing any variables between this page and the timetable pages. - if its all sesion stuff that should work.


    I presume the file exists... cant remember if the ASP engine preprocessor goes through the file and complain that an include doesnt exist even if its not in the execution path?


  • Registered Users Posts: 3,886 ✭✭✭cgarvey


    <!--#include file="relative_path_from_current_file"-->
    e.g.
    <!--#include file="includes/footer.inc"-->


    or

    <!--#include virtual="relative_URL_from_server_or_vhost_root"-->
    e.g.

    <!--#include virtual="/cgi-bin/counter.pl"-->


    The recommendation is to use virtual... Apache Ref

    You must also ensure that all included files exist (whether or not flow can get as far as the include directive)

    HTH

    .cg


  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    Originally posted by whiteshadow
    I don't think they are because I am getting an error saying
    that the include file cannot be found.

    <!--#include virtual="/timetables/CORKLONDON.asp"-->

    even if im looking at the DUBLIN site,
    i.e. with the dublin session loaded.
    The important thing to remember with Server-Side Include's (SSI's) is that they are 'loaded' into the host or calling script and effectively becomes part of it before any code execution. As such, even if you don't actually use that SSI in your execution, if the filepath given is wrong then your script will bork before it even starts executing.

    By the look of things, CORKLONDON.asp is not where it's supposed to be.


  • Advertisement
  • Registered Users Posts: 771 ✭✭✭whiteshadow


    Ah-ha...

    I had created none of the includes files as yet,
    was hoping to test one combination first,

    didn't realise that all the include files must exist first
    (whether or not flow can get as far as the include directive)

    thanks folks,

    all sorted now.


Advertisement