Ionize User Guide Version 0.9.6


Add PHP to views

Ionize's views accepts PHP.

Important: PHP is executed after the Ionize tags parsing. That means it is not possible to use PHP directly in tags attributes.

Simple PHP

// returns the current year
<?php echo date('Y'); ?>

Conditional PHP

Because the PHP code is executed after the Ionize tag parsing, the tags values can be tested.

<?php if ('<ion:title />' == 'Expertise') { echo('<ion:title tag="h2" />'); } ?>

Passing data from a tag to another tag attribute

<?php
  $tag = '<ion:field from="page" name="size" />';
    
  echo '<ion:title tag="'.$tag.'" />';
?>