Skip to main content
Participant
May 22, 2006
Answered

Session Variables - Application File

Can I set a certain page to ignore an IF statement in the application file which I want every other page on the site to take not of.
ie is it possible / is there an instruction that says don't read the application file in this page.
OR
Can someone explain how I can wrap the statement in an IF that says if the page is xxx then don't do the statement else do it.

Since this will run every page I need it to do the least work to keep processing times fast.

thanks for any ideas.

Simon
    This topic is closed to new replies. Start a new post to keep the conversation going.
    Newsgroup_UserCorrect answer
    Inspiring
    May 22, 2006
    sjmyles wrote:
    > Can I set a certain page to ignore an IF statement in the application file
    > which I want every other page on the site to take not of.

    Sure, if it's only one page you can check for CGI.SCRIPT_NAME and if
    it's the page you don't want to have execute a portion of your
    Application.cfm file, put that in a conditional based on the
    CGI.SCRIPT_NAME *not* being the page in question.

    > ie is it possible / is there an instruction that says don't read the
    > application file in this page.

    The other option is to put the page that you don't want to have execute
    the Application.cfm page in a separate directory and in that directory
    create another Application.cfm page. CF will use the Application.cfm
    page it finds first as it traverses up your directory tree. Not sure if
    that's an option because you may want the one page to which you're
    referring to execute the rest of the Application.cfm file, so I'm just
    pointing this out as another possibility.

    > OR
    > Can someone explain how I can wrap the statement in an IF that says if the
    > page is xxx then don't do the statement else do it.

    <cfif CGI.SCRIPT_NAME NEQ "page_that_should_ignore_stuff.cfm">
    <!--- do stuff here for every other page --->
    </cfif>

    You'll have to tweak this to match your situation but that would be the
    gist of what you'd have to do.

    Hope that helps,
    Matt
    --
    Matt Woodward
    mpwoodward@gmail.com
    Adobe Community Expert - ColdFusion

    1 reply

    Newsgroup_UserCorrect answer
    Inspiring
    May 22, 2006
    sjmyles wrote:
    > Can I set a certain page to ignore an IF statement in the application file
    > which I want every other page on the site to take not of.

    Sure, if it's only one page you can check for CGI.SCRIPT_NAME and if
    it's the page you don't want to have execute a portion of your
    Application.cfm file, put that in a conditional based on the
    CGI.SCRIPT_NAME *not* being the page in question.

    > ie is it possible / is there an instruction that says don't read the
    > application file in this page.

    The other option is to put the page that you don't want to have execute
    the Application.cfm page in a separate directory and in that directory
    create another Application.cfm page. CF will use the Application.cfm
    page it finds first as it traverses up your directory tree. Not sure if
    that's an option because you may want the one page to which you're
    referring to execute the rest of the Application.cfm file, so I'm just
    pointing this out as another possibility.

    > OR
    > Can someone explain how I can wrap the statement in an IF that says if the
    > page is xxx then don't do the statement else do it.

    <cfif CGI.SCRIPT_NAME NEQ "page_that_should_ignore_stuff.cfm">
    <!--- do stuff here for every other page --->
    </cfif>

    You'll have to tweak this to match your situation but that would be the
    gist of what you'd have to do.

    Hope that helps,
    Matt
    --
    Matt Woodward
    mpwoodward@gmail.com
    Adobe Community Expert - ColdFusion
    Translate