Mike.G,

Think of <&| ... &> ... </&> as a component that can "filter" or "wrap"
some specified content.

In Vince's example "some content" can be anything you want.  Then comp2
can retrieve it using $m->contents and do whatever it wants with it.

Here is another simple example to wrap some content up into a box.  This
is a pretty simple example, and it could've also been done easily with a
regular component and passing the contents as a variable.  I think the
main advantage of components with contents is that they can be called when
the content is more complicated such as other component calls or
substitutions.

box.mas:
------------------------------------------------------
<div class="box">
<% $m->contents %>
</div>

example.html:
------------------------------------------------------
<&| "box.mas" &>
  This is contents that would be wrapped in a box.
  You could put whatever you wanted in here.
</&>


Another example would be to refill a form with previous values:
http://www.masonhq.com/?FiltersAndHTMLFillInForm

And here is some more documentation and examples that may help clarify:
http://www.masonbook.com/book/chapter-5.mhtml#TOC-ANCHOR-10

Hope that helps.
Bradley C Bailey


> Hi,  Vince, thanks
>
> but I am not very clean understand <&| com2 &> some content </&> what's
that mean about this content "some content" ? we can use any content,
> it will be not show in comp1?
> so, why need this <&| &>...</&>?
>
> thanks
>
> Mike.G
>
>
> 2007/10/29, Vince Veselosky <[EMAIL PROTECTED]>:
>>
>> The <& x &> tag is a component call that behaves like an *include*
statement. It executes the component and replaces the tag with the
*output*
>> of the component (note: this is not the same as the return value).
>>
>> The <&| x &> is more like a start tag. It must be paired with an end
tag </&>, and the called component wraps around whatever is between the
start
>> and end. Simple example:
>>
>> comp1:
>> <&| comp2 &>some content here</&>
>>
>> comp2:
>> I am comp 2. comp1 said: "<% $m->content %>". The end.
>>
>> output:
>> I am comp 2. comp1 said: "some content here". The end.
>>
>> Details and other examples here:
>> http://masonhq.com/docs/manual/Devel.html#advanced_components_calls_with_c
>>
>>
>> On 10/29/07, »ÆÒ¶ <[EMAIL PROTECTED]> wrote:
>>
>> > Hi, All
>> > I had read the document about the developer manual on that web site.
but I am not very clean know well the what's the difference between
>> tag
>> > <& &> and <&| &> .
>> >
>> > that document say, this tag will be filter some content. that mean,
if components had been called have no return value, it will show the
content that been include tag?
>> > if components have any return ( content ), it will show component's
return content?
>> >
>> > could you give me a example?
>> >
>> >
>> > thanks
>> >
>> > Mike.G




-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Mason-users mailing list
Mason-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-users

Reply via email to