SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict
    Join Date
    Aug 2004
    Location
    philmont
    Posts
    315
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    if x then include y

    I've not really worked with asp at all other than fixing some stuff in my forums...

    What Im looking to do is make a script for my forums (the header) involving the date and an included page.

    If the month is 9 (September) then include page x
    elseif the month is 10 (October) then include page y
    else include page z

    How do I go about doing that? I know how to do it in php, but I'm looking to do it with asp.

  2. #2
    Just Blow It bronze trophy
    DaveMaxwell's Avatar
    Join Date
    Nov 1999
    Location
    Mechanicsburg, PA
    Posts
    7,264
    Mentioned
    115 Post(s)
    Tagged
    1 Thread(s)
    Because includes are processed before code is interpreted, you can't really do that. Now if the code in those pages is all self contained, you CAN wrap those in the if statements and the code just won't be executed, but both will actually be included before the processing occurs.

    HTH.
    Dave Maxwell - Manage Your Site Team Leader
    My favorite YouTube Video! | Star Wars, Dr Suess Style
    Learn how to be ready for The Forums' Move to Discourse

  3. #3
    SitePoint Addict
    Join Date
    Aug 2004
    Location
    philmont
    Posts
    315
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well....what Im looking for is for a few javascript codes and images to be included from other pages, rather than having to change them everytime the date changes. This way I can also leave the final page alone and then just change small things on the other various pages.

    with my php I'd usually do this::


    <?php

    $date = date('n');
    if($date == 1)
    {
    include_once('months/jan.inc.php');
    }
    elseif($date == 2)
    {
    include_once('months/feb.inc.php');
    }
    ?>

    all that are on these pages are small scripts- for example Febrauary has floating hearts with a matching banner name at the top of the page, January has another banner with snowflakes floating as a javascript.

    I'm just looking to place those within an asp style script to get them to work correctly. Is this possible? If so, how?

  4. #4
    SitePoint Wizard bbolte's Avatar
    Join Date
    Nov 2001
    Location
    The Central Plains
    Posts
    3,304
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    as Dave said, that doesn't work in ASP. different models here. however, there is something called Server.Execute that sorta maybe works like that. i've used it in some places where i needed dynamic includes.

    here's some info: http://www.google.com/search?sourcei...se.execute+asp


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
  •