Patrick
Patrick

Reputation: 2577

Is there a shorthand for <cfoutput>

It's just such a long tag and I use it so much.

For example

<input name="LastName" <cfoutput> value="#FORM.LastName#" </cfoutput> />

becomes

<input name="LastName" <?> value="#FORM.LastName#" </?> />

Maybe I'm just asking for too much.

Upvotes: 3

Views: 319

Answers (3)

Sathish Chelladurai
Sathish Chelladurai

Reputation: 700

<cfoutput>
    <form>
        <input name="LastName"  value="#FORM.LastName#"/>
    </form>    
</cfoutput>

Upvotes: 0

Evik James
Evik James

Reputation: 10503

Ideally, you wouldn't wrap such a small piece of code in a cfoutput. It really makes the code hard to read and maintain.

Instead, you should wrap larger and logical chunks of code in cfoutput. There's little additional overhead and it's much easier to read and maintain.

<cfoutput>
<form>
    <input value="#SomeVar#">
    <input value="#SomeVar#">
    <input value="#SomeVar#">
    <input value="#SomeVar#">
    <input value="#SomeVar#">
</form>
</cfoutput>

Upvotes: 12

Miguel-F
Miguel-F

Reputation: 13548

Nope <cfoutput> is all you get. For the tag syntax anyway. You could switch to script syntax instead.

<cfoutput>
    <p>hello</p>
</cfoutput>

versus

<cfscript>
    writeOutput("<p>hello</p>");
</cfscript>

You could always add a short-cut (keystroke) to your editor of choice for the tag.

Upvotes: 8

Related Questions