<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:clearspace="http://www.jivesoftware.com/xmlns/jive/rss" version="2.0">
  <channel>
    <title>Adobe Community : All Content - All Communities</title>
    <link>https://forums.adobe.com/</link>
    <description>All Content in Adobe Community</description>
    <language>en</language>
    <pubDate>Mon, 13 Oct 2014 15:10:47 GMT</pubDate>
    <generator>Jive Engage 7.0.0.1  (http://jivesoftware.com/products/)</generator>
    <dc:date>2014-10-13T15:10:47Z</dc:date>
    <dc:language>en</dc:language>
    <item>
      <title>Syntax for module's named parameters - need your feedback</title>
      <link>https://forums.adobe.com/thread/1602061</link>
      <description>&lt;!-- [DocumentBodyStart:67d7e4f9-cf2c-45d4-a2ab-e79f0189a5fa] --&gt;&lt;div class="jive-rendered-content"&gt;&lt;p&gt;Hi all.&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;We would like to make an improvement on the liquid&amp;#8217;s syntax for the module&amp;#8217;s named parameters and we need some input from you. We talked with a few of you &amp;#8220;live&amp;rdquo; at Adobe MAX about this, and we would appreciate some input from more of you.&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;strong style="font-size: 12pt;"&gt;How to specify if the module&amp;#8217;s output is suppressed or not?&lt;/strong&gt;&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Current syntax is, for the module_webapps for example:&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10.0pt; font-family: 'Courier New';"&gt;{module_webapps id="stores" filter="all" template=""}&lt;/span&gt;&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Basically, specifying an empty template will suppress the output of the module and will capture the module&amp;#8217;s data in a variable who&amp;#8217;s name it&amp;#8217;s auto-generate. For example, creating a page with the following code w&lt;span style="font-size: 13.3333330154419px;"&gt;ill suppress the output of the module and generate a variable in the page called &amp;#8220;webapps_0&amp;rdquo; what contains all the data generated by the webapps module (you will see this information in the &amp;#8220;this&amp;rdquo; variable outputted as JSON).&lt;/span&gt;&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10.0pt; font-family: 'Courier New';"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10.0pt; font-family: 'Courier New';"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10.0pt; font-family: 'Courier New';"&gt; &amp;lt;head&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10.0pt; font-family: 'Courier New';"&gt; &amp;lt;title&amp;gt;Untitled page&amp;lt;/title&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10.0pt; font-family: 'Courier New';"&gt; &amp;lt;meta name="description" content="" /&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10.0pt; font-family: 'Courier New';"&gt; &amp;lt;/head&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10.0pt; font-family: 'Courier New';"&gt; &amp;lt;body&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10.0pt; font-family: 'Courier New';"&gt; {module_webapps id="stores" filter="all" &lt;strong&gt;template=""&lt;/strong&gt;}&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10.0pt; font-family: 'Courier New';"&gt; {{this|json}}&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10.0pt; font-family: 'Courier New';"&gt; &amp;lt;/body&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10.0pt; font-family: 'Courier New';"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;This syntax can be confusing, so we would like to change this into:&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10.0pt; font-family: 'Courier New';"&gt;{module_webapps id="stores" filter="all" &lt;strong&gt;render=&amp;rdquo;nothing&amp;rdquo;&lt;/strong&gt;}&lt;/span&gt;&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Basically, add a render=&amp;rdquo;nothing&amp;rdquo; parameter that, if specified, will suppress the output of the module.&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;strong style="font-size: 12pt;"&gt;How to specify the variable in which a module data is captured?&lt;/strong&gt;&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;For the above example, if we would like that the data is not captured in a automatically-generated variable, currently you have to do it like this, using the &amp;#8220;collection&amp;rdquo; parameter.&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10.0pt; font-family: 'Courier New';"&gt;{module_webapps id="stores" filter="all" template="" &lt;strong&gt;collection=&amp;rdquo;myStoresVar&amp;rdquo;&lt;/strong&gt;}&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10.0pt; font-family: 'Courier New';"&gt;{{myStoresVar |json}}&lt;/span&gt;&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;This can also be somewhat confusing, so we would like to replace with:&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10.0pt; font-family: 'Courier New';"&gt;{module_webapps id="stores" filter="all" render=&amp;rdquo;nothing&amp;rdquo; &lt;strong&gt;var=&amp;rdquo;myStoresVar&amp;rdquo;&lt;/strong&gt;}&lt;/span&gt;&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;strong style="font-size: 12pt;"&gt;How to specify how to render a module that renders a list of data?&lt;/strong&gt;&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Currently the template you specify to the webapp module specifies how to render a single-item of data. So if I had a module in a page like this:&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10.0pt; font-family: 'Courier New';"&gt;{module_webapps id="stores" filter="all" template="/before-after/item.tpl"}&lt;/span&gt;&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;And the item.tpl would be:&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10.0pt; font-family: 'Courier New';"&gt;&amp;lt;div&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10.0pt; font-family: 'Courier New';"&gt; &amp;lt;h1&amp;gt;{{name}}&amp;lt;/h1&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10.0pt; font-family: 'Courier New';"&gt; &amp;lt;div&amp;gt;{{description}}&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10.0pt; font-family: 'Courier New';"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;The item.tpl would contain the template of a single item and the module would loop through every record resulting in an output like:&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10.0pt; font-family: 'Courier New';"&gt;&amp;lt;div&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10.0pt; font-family: 'Courier New';"&gt; &amp;lt;h1&amp;gt;Starbucks #240&amp;lt;/h1&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10.0pt; font-family: 'Courier New';"&gt; &amp;lt;div&amp;gt;&amp;lt;p&amp;gt;Starbucks -&amp;nbsp;505 S Flower St Los Angeles, CA 90071&amp;lt;/p&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10.0pt; font-family: 'Courier New';"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10.0pt; font-family: 'Courier New';"&gt;&amp;lt;div&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10.0pt; font-family: 'Courier New';"&gt; &amp;lt;h1&amp;gt;Starbucks #308&amp;lt;/h1&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10.0pt; font-family: 'Courier New';"&gt; &amp;lt;div&amp;gt;&amp;lt;p&amp;gt;Starbucks - 735 S Figueroa St #308 Los Angeles, CA, 90017&amp;lt;/p&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10.0pt; font-family: 'Courier New';"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;But if you want to be able to control in the template the layout of all of the things the module outputs (and get control of the loop), you currently have to do things like this:&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10.0pt; font-family: 'Courier New';"&gt;{module_webapps id="stores" filter="all" template="/before-after/list.tpl"}&lt;/span&gt;&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;And in the list.tpl:&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;strong style="font-size: 10.0pt; font-family: 'Courier New';"&gt;&amp;lt;!-- Liquid Enable Collection --&amp;gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10.0pt; font-family: 'Courier New';"&gt;{% for item in items %}&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10.0pt; font-family: 'Courier New';"&gt;&amp;lt;div&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10.0pt; font-family: 'Courier New';"&gt; &amp;lt;h1&amp;gt;{{item.name}}&amp;lt;/h1&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10.0pt; font-family: 'Courier New';"&gt; &amp;lt;div&amp;gt;{{item.description}}&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10.0pt; font-family: 'Courier New';"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10.0pt; font-family: 'Courier New';"&gt;{% endfor %}&lt;/span&gt;&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Notice that comment at the beginning of the template. That instructs BC that the template is not for a single item, but for the entire list, and so you get access to the &amp;rdquo;items&amp;rdquo; of the collection so that you can control the loop yourself.&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;The usage of the comment can also be confusing and more difficult to understand so we would propose not to use a comment in a template but use the same render=&amp;rdquo;&amp;rdquo; parameter, but with another value:&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10.0pt; font-family: 'Courier New';"&gt;{module_webapps id="stores" filter="all" &lt;strong&gt;render=&amp;rdquo;collection&amp;rdquo;&lt;/strong&gt; template="/before-after/list.tpl"} &lt;/span&gt;&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;And remove the comment from list.tpl:&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10.0pt; font-family: 'Courier New';"&gt;{% for item in items %}&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10.0pt; font-family: 'Courier New';"&gt;&amp;lt;div&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10.0pt; font-family: 'Courier New';"&gt; &amp;lt;h1&amp;gt;{{item.name}}&amp;lt;/h1&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10.0pt; font-family: 'Courier New';"&gt; &amp;lt;div&amp;gt;{{item.description}}&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10.0pt; font-family: 'Courier New';"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10.0pt; font-family: 'Courier New';"&gt;{% endfor %}&lt;/span&gt;&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;What do you guys think?&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;In this way we would have a consistent and simple way to define how a module is being rendered and how:&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10.0pt; font-family: 'Courier New';"&gt;{module_webapps id="stores" filter="all" &lt;strong&gt;render=&amp;rdquo;collection&amp;rdquo; template="/before-after/list.tpl&amp;rdquo;&lt;/strong&gt;}&lt;/span&gt; to get access in the module to the entire collection to loop through the items ourselves or&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10.0pt; font-family: 'Courier New';"&gt;{module_webapps id="stores" filter="all" &lt;strong&gt;render=&amp;rdquo;item&amp;rdquo; template="/before-after/item.tpl&amp;rdquo;&lt;/strong&gt;}&lt;/span&gt; to define only how every item looks and have the module loop for me (render=&amp;rdquo;item&amp;rdquo; would be by default to insure backwards compatibility, and in the template I am able to access the values directly).&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Any thoughts on this?&lt;/p&gt;&lt;p style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;-Lucian&lt;/p&gt;&lt;/div&gt;&lt;!-- [DocumentBodyEnd:67d7e4f9-cf2c-45d4-a2ab-e79f0189a5fa] --&gt;&lt;img src='/beacon?t=1415882770951' /&gt;</description>
      <pubDate>Mon, 13 Oct 2014 15:10:47 GMT</pubDate>
      <author>forums_noreply@adobe.com</author>
      <guid>https://forums.adobe.com/thread/1602061</guid>
      <dc:date>2014-10-13T15:10:47Z</dc:date>
      <clearspace:dateToText>1 month 1 day from now</clearspace:dateToText>
      <clearspace:replyCount>22</clearspace:replyCount>
      <clearspace:objectType>0</clearspace:objectType>
    </item>
  </channel>
</rss>

