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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dream Weaver Settings to help show unneeded # signs

Dream Weaver Settings

Dream Weaver Settings to help show unneeded # signs

by  TruthInSatire  Posted    (Edited  )
According to Macromedia's Livedocs

Macromedia recommends that you use pound signs only when necessary. The following example shows the preferred method for referencing variables.

[color #990000]<cfset SomeVar = Var1 + Max(Var2, 10 * Var3) + Var4>[/color]
In contrast, note the following example, which uses pound signs unnecessarily:
[color #990000]
<cfset #SomeVar# = #Var1# + #Max(Var2, 10 * Var3)# + #Var4#>
[/color]

A lot of people use pound signs when they are not needed like in the examples above and below. There is a setting you can change in dreamweaver to help see these extra hash marks.

If you use Dreamweaver, the below color scheme is what you may see when editing a coldfusion page in "code view".
Code:
[color #990000]<cfif[/color] [color blue]#trim([/color]form.fieldName[color blue])# eq [/color][color green]"someValue"[/color][color #990000]>
<cfoutput>[/color]#form.fieldName#[color #990000]</cfoutput>
</cfif>[/color]
In this case the extra hash marks are around the trim function:
[color blue]#trim([/color]form.fieldName[color blue])#[/color]

In dreamweaver MX / MX 2004 you can highlight these # signs.

click Edit > Preferences > select Code Coloring > select Coldfusion > click [color blue]Edit Coloring Scheme[/color] > select [color green]ColdFusion Script Bracket[/color] > click the "B" button to make the selected text bold* > click OK > click ok again on the preferences box.

*You can also change the color if you like, however it also changes ( and ) and [ and ] inside the coldfusion tags. In my opinion I thought it was more of a change to what I'm used to just to highlight a pound sign.

Your code will now be colored like this making it easy to identify extra unneeded hash marks. The bold pound signs below can/should be removed for best practice.
Code:
[color #990000]<cfif[/color] [color blue][b]#[/b]trim[b]([/b][/color]form.fieldName[color blue][b])#[/b] eq [/color][color green]"someValue"[/color][color #990000]>
<cfoutput>[/color]#form.fieldName#[color #990000]</cfoutput>
</cfif>[/color]
The below example shows what it looks like if you change the color for the [color green]ColdFusion Script Bracket[/color] setting along with making it bold. I'll use gold.
Code:
[color #990000]<cfif[/color] [color gold][b]#[/b][/color][color blue]trim[/color][b][color gold]([/color][/b]form.fieldName[color gold][b])#[/b][/color][color blue] eq [/color][color green]"someValue"[/color][color #990000]>
<cfoutput>[/color]#form.fieldName#[color #990000]</cfoutput>
</cfif>[/color]

Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top