[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&nbsp; by $m-&gt;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 &lt;<a \
href="mailto:mason@brad.memoryleak.org">mason@brad.memoryleak.org</a>&gt;:</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 &lt;&amp;| ... &amp;&gt; ... \
&lt;/&amp;&gt; as a component that can &quot;filter&quot; or &quot;wrap&quot;<br>some \
specified content.<br><br>In Vince&#39;s example &quot;some content&quot; can be \
anything you want.&nbsp;&nbsp;Then comp2 <br>can retrieve it using $m-&gt;contents \
and do whatever it wants with it.<br><br>Here is another simple example to wrap some \
content up into a box.&nbsp;&nbsp;This<br>is a pretty simple example, and it \
could&#39;ve also been done easily with a <br>regular component and passing the \
contents as a variable.&nbsp;&nbsp;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>&lt;div \
class=&quot;box&quot;&gt;<br>&lt;% $m-&gt;contents \
%&gt;<br>&lt;/div&gt;<br><br>example.html:<br>------------------------------------------------------
 <br>&lt;&amp;| &quot;box.mas&quot; &amp;&gt;<br>&nbsp;&nbsp;This is contents that \
would be wrapped in a box.<br>&nbsp;&nbsp;You could put whatever you wanted in \
here.<br>&lt;/&amp;&gt;<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>&gt; Hi,&nbsp;&nbsp;Vince, \
thanks<br>&gt;<br>&gt; but I am not very clean understand &lt;&amp;| com2 &amp;&gt; \
some content &lt;/&amp;&gt; what&#39;s <br>that mean about this content &quot;some \
content&quot; ? we can use any content,<br>&gt; it will be not show in comp1?<br>&gt; \
so, why need this &lt;&amp;| &amp;&gt;...&lt;/&amp;&gt;?<br>&gt;<br>&gt; \
thanks<br>&gt;<br> &gt; Mike.G<br>&gt;<br>&gt;<br>&gt; 2007/10/29, Vince Veselosky \
&lt;<a href="mailto:vince@control-escape.com">vince@control-escape.com</a>&gt;:<br>&gt;&gt;<br>&gt;&gt; \
The &lt;&amp; x &amp;&gt; 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>&gt;&gt; of the component (note: this is not the same as the \
return value).<br>&gt;&gt;<br>&gt;&gt; The &lt;&amp;| x &amp;&gt; is more like a \
start tag. It must be paired with an end <br>tag &lt;/&amp;&gt;, and the called \
component wraps around whatever is between the<br>start<br>&gt;&gt; and end. Simple \
example:<br>&gt;&gt;<br>&gt;&gt; comp1:<br>&gt;&gt; &lt;&amp;| comp2 &amp;&gt;some \
content here&lt;/&amp;&gt; <br>&gt;&gt;<br>&gt;&gt; comp2:<br>&gt;&gt; I am comp 2. \
comp1 said: &quot;&lt;% $m-&gt;content %&gt;&quot;. The end.<br>&gt;&gt;<br>&gt;&gt; \
output:<br>&gt;&gt; I am comp 2. comp1 said: &quot;some content here&quot;. The end. \
<br>&gt;&gt;<br>&gt;&gt; Details and other examples here:<br>&gt;&gt; <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>&gt;&gt;<br>&gt;&gt;<br>&gt;&gt; On 10/29/07, »ÆÒ¶ &lt;<a \
href="mailto:hylinux@gmail.com">hylinux@gmail.com</a>&gt; \
wrote:<br>&gt;&gt;<br>&gt;&gt; &gt; Hi, All<br>&gt;&gt; &gt; I had read the document \
about the developer manual on that web site. <br>but I am not very clean know well \
the what&#39;s the difference between<br>&gt;&gt; tag<br>&gt;&gt; &gt; &lt;&amp; \
&amp;&gt; and &lt;&amp;| &amp;&gt; .<br>&gt;&gt; &gt;<br>&gt;&gt; &gt; 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>&gt;&gt; &gt; if components have any return ( content ), it will show \
component&#39;s<br>return content?<br>&gt;&gt; &gt; <br>&gt;&gt; &gt; could you give \
me a example?<br>&gt;&gt; &gt;<br>&gt;&gt; &gt;<br>&gt;&gt; &gt; thanks<br>&gt;&gt; \
&gt;<br>&gt;&gt; &gt; \
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?&nbsp;&nbsp;Stop.<br>Now Search log events and configuration \
files using AJAX and a browser.<br>Download your FREE copy of Splunk now &gt;&gt;  <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