开发者

Passing variables to cfinclude

How can I pass a variable to a cfm page that I'm including from another page?

Example:

<cfset a.name = "me">
<cfset a.age = 135>
<开发者_如何学Python;cfinclude template="displayNameAndAgeFrom_A.cfm">

and displayNameAndAgeFrom_A.cfm is

<cfoutput>#a.name# #a.age#</cfoutput>

Thanks!


AFAIK, this should work, exactly the way you posted it, without having to pass anything at all. Any values available in the outside/calling page are available in the included page.


Also worth noting that you also have <cfmodule ... /> available. cfmodule will let you call the same template but you can pass in different values for the same attributes.

Check out ColdFusion 9 documentation on cfmodule.

This template/module however will only have access to a handful of scopes that the caller template has access to: request, session and application

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜