Multiformat article

29 January 2014, 13:09

Keywords: filter, content

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

EPUB format. Price: $6.99

Available formats

The search can be provided by etc_search if needed:

Code

Article body
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
<div role="format" data-type="print"><p>The default print format. Price: $<span>7.99</span></p></div>
<div role="format" data-type="pdf"><p>PDF file. Price: $<span>5.99</span></p></div>
<div role="format" data-type="epub"><p>EPUB format. Price: $<span>6.99</span></p></div>
Article form (simplified)
<txp:if_individual_article>
<h2 class="entry-title"><txp:permlink><txp:title /></txp:permlink></h2>
<txp:etc_query data='<txp:body />' globals="_GET">
	{*[not(@role) or @role!='format']}
	{*[@role='format' and @data-type='{?format|print}']}
	<h4>Available formats</h4>
	<ul>
		{*[@role='format']@@&=<li><a href="<txp:permlink />?format={@data-type?}">{@data-type?}</a> (${.//span?})</li>}
	</ul>
</txp:etc_query>
<txp:else />
<!-- list form -->
</txp:if_individual_article>

File(s)