tags:

views:

71

answers:

2
<cfoutput query="getGames">
<li>
<a href="#link_url#" style="background: #E97B2A; display: block; height: 320px; width: 500px;">#name#</a>
</li>
</cfoutput>

the background color # is breaking it, how can I display the # without closing the cfoutput tag (or using css rgb() )?

+5  A: 

The # symbol can be escaped within cfoutput tags and in other areas such as strings by doubling it up like ##.

So you need to use the following code:

<cfoutput query="getGames">
<li>
<a href="#link_url#" style="background: ##E97B2A; display: block; height: 320px; width: 500px;">#name#</a>
</li>
</cfoutput>
Loftx
+1  A: 

Loftx's answer will work perfectly. But another option is to move the CSS styling to a .css file or to a style area of your page that sits outside of your cfoutput tags.

<!--- outside the cfoutput you can use single # characters --->
<style type="text/css">
.mystyle { background: #E97B2A; display: block; height: 320px; width: 500px; }
</style>

<!--- inside the cfoutput, # characters must be paired up. --->
<cfoutput query="getGames">
    <li>
        <a href="#link_url#" class="mystyle">#name#</a>
    </li>
</cfoutput>
Dan Sorensen
the inline styles are for debugging purposes, the block is going to be replaced by flash so i just wanted to know a quick way to use a #
davidosomething