2 Replies Latest reply on Oct 6, 2006 10:18 AM by Exmachin4

    Cfif and displaying images.

    Exmachin4 Level 1
      Here the issue.

      My company has an Events page user put events onto it.
      Well If the company is runing it my boss wants to show an image.

      The yes/ no or true /false will come from an admin form.
      So what would the <cfif> look like?

      <cfif (yes)>
      <img src="image.jpg">

      I think that is close not sure what does between <cfif> and (yes) though.

      Thanks for the help
        • 1. Re: Cfif and displaying images.
          azadisaryev Level 1
          the cfif clause will absolutely depend on the database structure, if you are using a database. i presume you are, as you must be storing the event info somewhere, although you could be doing it in a text file, too...

          basically, you will have to check for the value of the field (db column) that stores the yes/no value for the clause "is event run by company".

          so if, for example, your 'events' table stores the yes/no answer from the admin form in a 'is_run_by_company' column, then in the page that displays events:

          <!--- get even data: --->
          <cfquery name='getEvents' datasource='yourDSN'>
          SELECT * FROM events

          <!--- show even info --->
          <cfoutput query='getevents'>
          <cfif getEvents.is_run_by_company is true><img scr='image.jpg'></cfif>

          if you do not understand the above, then post your code here. post both the page that enteres event data into db and the page that displays even data on screen. just the db queries and forms will do - no need for other code on the pages.
          • 2. Re: Cfif and displaying images.
            Exmachin4 Level 1
            Sorry took me so long to reply.

            It worked perfectly. Thank for the help!