문제

Is it possible to reference a cf variable in html? Example:

<cfset  langValue ="uk">

<html lang="#langValue#">

In this way does not work, however if I then print it out with cf tags it obviously works:

<cfoutput> #langValue# </cfoutput>

Any how to reference the langValue variable in the html lang tag?

도움이 되었습니까?

해결책

You just have to make sure to wrap your HTML in the cfoutput :

<cfoutput>
    <html lang="#langValue#">
</cfoutput>

다른 팁

I don't use cfset any longer. The new hotness is:

<cfscript>
langValue = 'uk'
</cfscript>
<cfoutput>
<html lang="#langValue#">
</html>
</cfoutput>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top