Home

Castle Stronghold

ViewComponents

Brail support the following syntax for ViewComponents:


<%
component MyViewComponent
%>

The above will call MyViewComponent and send any output from the component to the browser.

You can also use view components with arguments. Those arguments are passed via a dictionary (Hash table), like this:


<%
component MyViewComponentWithParams, {"arg" : "value" }
%>

If you want to pass a body to the component, just use the normal colon + indnet to do so:


<% component MyViewComponentWithBody: %>
html content that will be sent to the user if the component will call the RenderBody() method
<% end %>

The contents of a component is "evaluated" when you call RenderBody, so if you will call RenderBody multiply times, you will send the output of the component's body multiply times as well.

Google
Search WWW Search castleproject.org