LiveWhale CMS

Welcome, Guest Login

Support Center

Our documentation is moving:

Please check for the most up-to-date LiveWhale CMS and LiveWhale Calendar documentation. The below legacy documentation will remain available as a reference until the documentation migration is complete.

XPHP Examples

Last Updated: Jun 28, 2016 03:00PM PDT
Below is a collection of xphp examples to handle various scenarios:

Basic If condition

If a Profile type equals "Faculty", then....
<xphp content="true">
 <if var="profiles_type" value="Faculty"/>
   window.lw_profiles_type = 'faculty'; 

Show a navigation if Profiles type equals _____

If a Profile type equals "Alumni", then display the Alumni navigation using a navigation widget type and pass the id of the Alumni navigation.
<xphp content="true">
 <if var="profiles_type"value="Alumni"/>
    <widget type="navigation" inner="true">
        <arg id="id">21</arg>
         <arg id="include_hidden">true</arg>

If this page's template is X then .....

In the example below we are checking if the page is using the academic department template. If so, add the breadcrumbs: Home » Academics » Majors & Minors

 <xphp content="true">
    <if var="page_template" value="/_templates/academic-department.php" />
            <div class="breadcrumb">
              <a href="/">Home</a> » <a href="/academics/">Academics</a> » <a href="/academics/programs/">Majors &amp; Minors</a>

If/Else Condition

The example below demonstrates the structure of an if/else xphp statement 

<xphp content="true">
    <!-- if the group title is equal to Academics  then display the specified widget-->
    <!-- Note: self-enclosed if statement -->
var="group_title" value="Academics"/>
<widget id="1218"></widget>
      <!-- Else,  include the title heading and links to the previous and next story-->

    <else content="true">
             <h1 class="title"><xphp var="group_title"/></h1>
class="left arrow ir">Previous Story</div>
class="right arrow ir">Next Story</div>
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
Invalid characters found