Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CFIF give me info, CFELSE Not

Status
Not open for further replies.

movium

Technical User
Feb 18, 2002
14
SE
Hi,
I have list of courses that we are offering at the University. Each course in the list links to a new page that is giving information about the specific course. The information is given in two steps over time before the course starts.
1. short info(at the beginning).
2. further info, cost, program etc. (The second step is given 2 months before the start).

The problem is that I would like to use only one table in the database and only one template (i.e. course_info.cfm)to show the info. The headings are HTML-tags and I want them to be visible only if there is information to be given from the database. How do I create a CFIF/CFELSE-expression that will work?

Regards
Niclas
Movium
 
You can select the information from the database, and if there is no further info, then do not show the information.

e.g
<cfquery name=&quot;foo&quot; datasource=&quot;bar&quot;>
Select shortinfo,furtherinfo,cost,program from Courses
Where courseID = #courseID#
</cfquery>

<cfoutput query=&quot;foo&quot;>
#ShortInfo#

<cfif foo.program is NOT &quot;&quot;>
<!-- Put header for More informatin here -->
#Cost# #Program#
<cfelse>
<!-- Since Program was blank, assume that there is no more information and show the no information here -- >

Course has not started yet, please check back later.
</cfif>

</cfoutput>

You can put your html tags inside the
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top