Add PHP to views

From release 0.9.9, PHP can mostly be avoided in views.
If you need conditional data test, have a look at the chapter Conditions with tags.

// 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:page:title />' == 'About' ) :?>

   <p>This content is displayed if the title of the page is "About"</p>

<?php endif ;?>

Passing data from one tag to one tag attribute

  // Get the title of the page
  $page_title = '<ion:page:get key="title" />';



  <!-- For each article, we display the page title as prefix -->

    echo '<ion:article:title prefix="'.$page_title.' : " />';