Connecting Tech Pros Worldwide Forums | Help | Site Map

Limiting text output using CFM

Newbie
 
Join Date: Jan 2007
Posts: 1
#1: Jan 13 '07
I have a news website in which I want to display about three lines of each entry whiles the rest of the story is read on a detail page. Can somebody help me out with the code to do that? Below is my output query:

<CFOUTPUT query="Comments" maxrows=10>
<a href="cad_cn_detail.cfm?tblNewsCatID=#tblNewsCatID &tblNewsID=#tblNewsID#" class="menu04">#cComment#</a>
</CFOUTPUT>

Thanks.

acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#2: Jan 13 '07

re: Limiting text output using CFM


Quote:

Originally Posted by chrisdonkor

I have a news website in which I want to display about three lines of each entry whiles the rest of the story is read on a detail page. Can somebody help me out with the code to do that? Below is my output query:

<CFOUTPUT query="Comments" maxrows=10>
<a href="cad_cn_detail.cfm?tblNewsCatID=#tblNewsCatID &tblNewsID=#tblNewsID#" class="menu04">#cComment#</a>
</CFOUTPUT>

Thanks.

Use the left function, but you have to specify the number of characters, e.g.
Expand|Select|Wrap|Line Numbers
  1. <CFOUTPUT query="Comments" maxrows=10> 
  2. <a href="cad_cn_detail.cfm?tblNewsCatID=#tblNewsCatID&tblNewsID=#tblNewsID#" class="menu04">#left(cComment,100)#</a>
  3. </CFOUTPUT>
Reply