I know that with MG, you can declare something like this in your view:

<cfset event.setValue("section", "Tables")>

Then use it in your main template like this:

<h3>#event.getValue("section")#</h3>

But I'd like to be able to a block of HTML into the template. Using
MG, I know it's possible to include two separate files into one
template:

<event-handler name="page.test">
    <views>
        <include name="sidebar" template="sidebar.cfm"/>
        <include name="body" template="page.cfm"/>
        <include name="main" template="main.cfm"/>
    </views>
</event-handler>

But I need the ability to declare the sidebar content within the view
itself, since it will be some very simple HTML, like an image with a
description and a link. I think I can do it using cfsavecontent:

<cfsavecontent variable="sidebar">
    <img src="picture.jpg"/>Picture of a <a
href="hibiscus.html">hibiscus</a>
</cfsavecontent>

<cfset event.setValue("sidebar", sidebar)>

But is there a better way of doing this?

P.S. I'm trying to find an equivalent to ASP.NET MVC 3's @section
feature. I asked on Stack Overflow but I haven't received a
satisfactory answer yet:

http://stackoverflow.com/questions/7254664/what-is-coldfusion-model-glues-equivalent-to-asp-net-mvc-3s-section

-- 
Model-Glue Sites:
Home Page: http://www.model-glue.com
Documentation: http://docs.model-glue.com
Bug Tracker: http://bugs.model-glue.com
Blog: http://www.model-glue.com/blog

You received this message because you are subscribed to the Google
Groups "model-glue" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/model-glue?hl=en

Reply via email to