Skip to content
partikule edited this page Sep 23, 2011 · 25 revisions

Answers to common questions about tags.

Medias

How to display a media in an enclosing HTML tag only if it exists ?

<?php if ('<ion:media type="picture" attr="src" />' != '') :?>
   <img src="<ion:media type='picture' attr='src' />" />
<?php endif;?>

Articles

How to display a H2 title tag only if the article's title exists ?

<ion:articles>
  <ion:title tag="h2" class="my_h2_class" id="my_h2_id" />
</ion:articles>

How to display an article link only if this article links to an external URL ?

<?php if ('<ion:field name="link_type" />' == 'external') :?>
   <a href="<ion:url />">go to External Link</a>
<?php endif ;?>

link_type can have 3 values :

  • page
  • article
  • external

It can also be empty.

How to add a CSS class to the first article only ?

<ion:articles>
  <div <?php if ('<ion:index />' == '1') :?> class="my-first-article" <?php endif;?> >
    <ion:title />
    ...
  </div>
</ion:articles>

Content Elements

How to display Content Elements?

(only from 0.9.7.5)

<ion:elements type="element_name">

	<!-- Attributes of the Element -->
	<ion:attribute name="name" /><br />
	<ion:attribute name="title" /><br />
	
	<!-- Loop into the element fields -->
	<ion:fields>
			
		<!-- Internal attribute of the field : name, label -->
		<ion:attribute name="name" />, <ion:attribute name="label" /> : 

		<!-- User value for the field -->
		<ion:attribute name="content" autolink="true" /><br />
			
	</ion:fields>
	
</ion:elements>