Glad to have that fixed. I felt like I was being given the silent
treatment. I did poor through some ModelGlue CFC's and learned a
bunch, yay :P
A few things I added to EventContext.CFC if anyone cares for them,
I'll post here.
In an attempt to display the view's template from within a view, I
created these. A note, expandPath(view.template) doesn't get the view
folder. I saw how that was done in RenderView.cfc but it looked too
messy to try and pull out. But anyway, the functions I added are.
<cffunction name="getViewStruct" access="public" output="false"
hint="I get the view.">
<cfargument name="name" required="true" hint="I am the name of the
view to get.">
<cfset var next = variables._firstView>
<cfloop condition="isStruct(next)">
<cfif next.view.name EQ arguments.name>
<cfreturn next.view>
</cfif>
<cfset next = next.next>
</cfloop>
<cfreturn next />
</cffunction>
<cffunction name="getViewTemplate" access="public" output="false"
hint="I get the view template.">
<cfargument name="name" required="true" hint="I am the name of the
view to get.">
<cfset var view = getViewStruct(name)>
<cfset var result = "">
<cfif isStruct(view) and StructKeyExists(view, 'template')>
<cfset result = view.template>
</cfif>
<cfreturn result />
</cffunction>
To make them work, have to patch function queueView to include a link
to the _firstView, since when getNextView starts being called, the
link to the first view is apparently lost.
In the function renderView I patched to add this addTraceStatement()
<cfset addView(...) />
<cfset addTraceStatement("Rendered View ""#view.name#"" ",
variables._viewCollection.getFinalView()) />
</cffunction>
So I could see what was being generated for each view as it was
rendered. This really helped me see that absolutely nothing was the
result of the views without the surrounding <cfoutput> tags discussed
above.
All this digging made me desire a View class that stands on its own,
instead of buried withing multiple CFC's. But trying to do that would
possibly break something that is already working, and I have to slap
my hand every time I try something like that. Ha.
But it would go a long way towards adding a view scope to views. It
would be nice to be able to do a simple expandPath(view.template)
within the template. Something I'll have to work on at some point.
<cfif not isStruct(variables._nextView)>
<cfset variables._firstView = link />
<cfset variables._nextView = link />
<cfset variables._lastView = link />
<cfelse>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---