What about CaptureFor ?

http://www.castleproject.org/monorail/documentation/trunk/viewcomponents/capturefor.html


2009/2/19 James Curran <[email protected]>

>
> This is one of the reason I create the InsertJavascript ViewComponent
> (In CastleContrib)
>
> In you layout, you'd say
>
> #component(InsertJavascript)
>
> In your view, you'd say
>
> #component(Javascript with "file=index.js")
>
>
> There's a whole bunch of other options/features, but those two will
> handle what you want.
>
> On Feb 18, 3:36 pm, dfa_geko <[email protected]> wrote:
> > Hi All!
> >
> > I guess I should have read that the forums are deprecated :-)
> >
> > I'm not sure how to explain this.  I'm using NVelocity.  Basically, I
> > have want different view templates to have their own javascript files.
> > Yet, I also have a default template.  I got it to work, but perhaps
> > not in the right way.  Perhaps a little bit of code can help explain.
> >
> > In my default.vm page, I have this:
> >
> > #if ($script)
> >     <script type="text/javascript" src="$siteroot/Content/js/
> > $script"></script>
> > #end
> > ...
> > <div id="content">
> > $childContent
> > </div>
> >
> > Notice the $script variable in the script src attribute.  Also notice
> > that I'm using the $childContent variable to bring in a sub-template
> > (nested template).  (I'm not exactly sure what they are called)
> >
> > In my controller:
> >
> > PropertyBag.Add("script", "index.js");
> >
> > I add "index.js" into the property bag.  This loads it up just fine.
> >
> > Now, is this a good way of bringing in the index.js file?  Am I
> > missing something from the framework that would do this?  Is it bad
> > that the controller needs to know about index.js since it is more part
> > of the view?  Forgive me, I'm very new to Monorail.
> >
> > Thanks!
> >
>


-- 

Ricardo Lopes

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" 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/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to