Pergunta

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?

Foi útil?

Solução

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

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

Outras dicas

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

<cfscript>
langValue = 'uk'
</cfscript>
<cfoutput>
<html lang="#langValue#">
</html>
</cfoutput>
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top