Hello all, I have sequence of Posts to render. The Post object has an involved xml-template as show below <!-- List of recent Posts --> <n:invisible n:data="recentPosts" n:render="sequence"> <!-- A Post --> <div n:pattern="item" class="blogEntryBody"> <h2 class="title"> <n:invisible n:data="title" n:render="post_title"/> </h2> <div n:data="at" n:render="post_date" class="date"></div> <div n:data="body" n:render="xml"></div> <div class="posted"> in <span n:data="tags" n:render="sequence"> <n:invisible n:pattern="item" n:render="tag"></n:invisible> <span n:pattern="divider">|</span> </span> </div> </div> </n:invisible> Now, I need to re-use this Post pattern (below 'A Post comment) in multiple places. If you place them in a seperate file, it would be imposibble to use them in this example (sequence renderer). Do you think of any solution? "duplication is bad idea, so could not resist" -- Sridhar Ratna - http://srid.bsdnerds.org
I have sequence of Posts to render. The Post object has an involved xml-template as show below [snip ... code]
Now, I need to re-use this Post pattern (below 'A Post comment) in multiple places. If you place them in a seperate file, it would be imposibble to use them in this example (sequence renderer).
Do you think of any solution?
I just looked at Fragments (rend.Fragment). The problem with fragment is Post data comes from outside the fragment (outer tag's 'data' attribute). How is it possible to send the data to fragment Please note that this DOES NOT work <n:invisible n:data="recentPosts" n:render="sequence"> <n:invisible n:render="content"> <n:slot name="content" /> </n:invisible> </n:invisible> actually 'content' has the patterns for the 'recentPosts' sequence, but nevow throws exception "The pattern named 'item' wasn't found in the template." -- Sridhar Ratna - http://srid.bsdnerds.org
participants (1)
-
Sridhar Ratna aka Srid