SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Aug 2009
    Posts
    159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    <cfif structheader

    Hi ive the below piece of code, in which at the minute if PRINTPRICE exists in the csv file and is equal to "Y" is shows the prices otherwise they are hidden

    Code:
    <cfif structheader.PRINTPRICE eq "Y">
    </cfif>
    The above is working fine, but on older csv files it doesn't have "PRINTPRICE" so if "PRINTPRICE" doesn't exist I want it to display the prices by default

    I was using the below piece of code but the prices are still been hidden on me
    any one any tips on sorting this?
    Thanks

    Code:
    <cfif isdefined ("structheader.PRINTPRICE")>
    	 <cfif structheader.PRINTPRICE eq "Y" OR "">

  2. #2
    SitePoint Zealot
    Join Date
    May 2005
    Location
    Suwanee GA
    Posts
    118
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think you have to be more literal in the second part of the or statement.
    Code:
    <cfif structheader.PRINTPRICE eq "Y" OR structheader.PRINTPRICE eq "">
    Alternatively, if PRINTPRICE is not defined you could use a negative NOT isDefined.

    Code:
    <cfif not isDefined('structheader.PRINTPRICE')>
      ...do default
    <cfelseif structheader.PRINTPRICE EQ "Y">
      ...do something specific
    <cfelse>
     ... do something else
    </cfif>


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
  •