[prev in list] [next in list] [prev in thread] [next in thread]
List: mason
Subject: Re: [Mason] what's difference between <& &> and <&| &>?
From: "=?GB2312?B?u8bStg==?=" <hylinux () gmail ! com>
Date: 2007-10-30 2:23:40
Message-ID: 74646cb40710291923y28dfde8k5da521ece16c5240 () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
thanks guys.
now, I got it.
in the comp2, we can retrieve it by $m->content, and do some filter.
thanks very much.
Mike.G
2007/10/30, Bradley C Bailey <mason@brad.memoryleak.org>:
>
> 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 <vince@control-escape.com>:
> >>
> >> 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, »ÆÒ¶ <hylinux@gmail.com> 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
>
[Attachment #5 (text/html)]
thanks guys.<br>now, I got it.<br>in the comp2, we can <span class="q" \
id="q_115ecb2a68ce57ec_0"> retrieve it by $m->content, and do some \
filter.<br><br>thanks very much.<br><br>Mike.G<br><br></span><br><div><span \
class="gmail_quote"> 2007/10/30, Bradley C Bailey <<a \
href="mailto:mason@brad.memoryleak.org">mason@brad.memoryleak.org</a>>:</span><blockquote \
class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt \
0pt 0.8ex; padding-left: 1ex;"> Mike.G,<br><br>Think of <&| ... &> ... \
</&> as a component that can "filter" or "wrap"<br>some \
specified content.<br><br>In Vince's example "some content" can be \
anything you want. Then comp2 <br>can retrieve it using $m->contents \
and do whatever it wants with it.<br><br>Here is another simple example to wrap some \
content up into a box. This<br>is a pretty simple example, and it \
could've also been done easily with a <br>regular component and passing the \
contents as a variable. I think the<br>main advantage of components with \
contents is that they can be called when<br>the content is more complicated such as \
other component calls or<br> \
substitutions.<br><br>box.mas:<br>------------------------------------------------------<br><div \
class="box"><br><% $m->contents \
%><br></div><br><br>example.html:<br>------------------------------------------------------
<br><&| "box.mas" &><br> This is contents that \
would be wrapped in a box.<br> You could put whatever you wanted in \
here.<br></&><br><br><br>Another example would be to refill a form with \
previous values: <br><a \
href="http://www.masonhq.com/?FiltersAndHTMLFillInForm">http://www.masonhq.com/?FiltersAndHTMLFillInForm</a><br><br>And \
here is some more documentation and examples that may help clarify:<br><a \
href="http://www.masonbook.com/book/chapter-5.mhtml#TOC-ANCHOR-10"> \
http://www.masonbook.com/book/chapter-5.mhtml#TOC-ANCHOR-10</a><br><br>Hope that \
helps.<br>Bradley C Bailey<br><br><br>> Hi, Vince, \
thanks<br>><br>> but I am not very clean understand <&| com2 &> \
some content </&> what's <br>that mean about this content "some \
content" ? we can use any content,<br>> it will be not show in comp1?<br>> \
so, why need this <&| &>...</&>?<br>><br>> \
thanks<br>><br> > Mike.G<br>><br>><br>> 2007/10/29, Vince Veselosky \
<<a href="mailto:vince@control-escape.com">vince@control-escape.com</a>>:<br>>><br>>> \
The <& x &> tag is a component call that behaves like an *include* \
<br>statement. It executes the component and replaces the tag with \
the<br>*output*<br>>> of the component (note: this is not the same as the \
return value).<br>>><br>>> The <&| x &> is more like a \
start tag. It must be paired with an end <br>tag </&>, and the called \
component wraps around whatever is between the<br>start<br>>> and end. Simple \
example:<br>>><br>>> comp1:<br>>> <&| comp2 &>some \
content here</&> <br>>><br>>> comp2:<br>>> I am comp 2. \
comp1 said: "<% $m->content %>". The end.<br>>><br>>> \
output:<br>>> I am comp 2. comp1 said: "some content here". The end. \
<br>>><br>>> Details and other examples here:<br>>> <a \
href="http://masonhq.com/docs/manual/Devel.html#advanced_components_calls_with_c">http://masonhq.com/docs/manual/Devel.html#advanced_components_calls_with_c
</a><br>>><br>>><br>>> On 10/29/07, »ÆÒ¶ <<a \
href="mailto:hylinux@gmail.com">hylinux@gmail.com</a>> \
wrote:<br>>><br>>> > Hi, All<br>>> > I had read the document \
about the developer manual on that web site. <br>but I am not very clean know well \
the what's the difference between<br>>> tag<br>>> > <& \
&> and <&| &> .<br>>> ><br>>> > that document \
say, this tag will be filter some content. that mean, <br>if components had been \
called have no return value, it will show the<br>content that been include \
tag?<br>>> > if components have any return ( content ), it will show \
component's<br>return content?<br>>> > <br>>> > could you give \
me a example?<br>>> ><br>>> ><br>>> > thanks<br>>> \
><br>>> > \
Mike.G<br><br><br><br><br>-------------------------------------------------------------------------
<br>This SF.net email is sponsored by: Splunk Inc.<br>Still grepping through log \
files to find problems? Stop.<br>Now Search log events and configuration \
files using AJAX and a browser.<br>Download your FREE copy of Splunk now >> <a \
href="http://get.splunk.com/">http://get.splunk.com/</a><br>_______________________________________________<br>Mason-users \
mailing list<br><a href="mailto:Mason-users@lists.sourceforge.net">Mason-users@lists.sourceforge.net
</a><br><a href="https://lists.sourceforge.net/lists/listinfo/mason-users">https://lists.sourceforge.net/lists/listinfo/mason-users</a><br></blockquote></div><br>
-------------------------------------------------------------------------
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
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic