Forum Moderators: open

Message Too Old, No Replies

<a href="#link"> inside a <cfoutput> tag.

How do you prevent coldfusion from generating an error?

         

j0ned

2:25 pm on Sep 25, 2006 (gmt 0)

10+ Year Member



Ok.. So I have my query in index.cfm

<cfquery name="cheese">
SELECT ..........
</cfquery>

now, here's the output of 'cheese'

<cfoutput query="cheese">
<tr>
<td>#subject# - #date#</td>
</tr>
<tr>
<td>#maindata# - <a href="article.cfm?id=#rowid##link">Discuss</a></td>
</tr>
</cfoutput>

Ok, the problem obviously occures in the link. I'm trying to allow users to jump straight to the 'discussion' portion of the article.cfm (<a name="link">discussion</a>) document, but coldfusion throws an error because #link (in the href) doesn't have a trailing #, but it's not a coldfusion command!

How can I get around this? I thought maybe an &<code>;, but I was unable to find one for a #.

Sorry if the question isn't clear :-/ Ask if you're confused, please. I'm probably overlooking the easy solution.

j0ned

4:48 pm on Sep 25, 2006 (gmt 0)

10+ Year Member



After a couple hours of googling(is that a werd? :P)

I found out if you double up the #'s, it'll werk.

<cfoutput query="queryname">

<a href="article.cfm?id=#rowid###comments">Comments</a>

</cfoutput>

Coldfusion will omit the second #, for example ##comments werks instead of #comments.