LiveWhale CMS

Welcome, Guest Login

Support Center

Our documentation is moving: docs.livewhale.com

Please check docs.livewhale.com 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"/>
 <content>
   window.lw_profiles_type = 'faculty'; 
 </content>
 </xphp>

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"/>
  <content>
    <widget type="navigation" inner="true">
        <arg id="id">21</arg>
         <arg id="include_hidden">true</arg>
    </widget>
   </content>
  </xphp>

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" />
        <content>
            <div class="breadcrumb">
              <a href="/">Home</a> » <a href="/academics/">Academics</a> » <a href="/academics/programs/">Majors &amp; Minors</a>
            </div>
        </content>
</xphp>

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 -->
    <if
var="group_title" value="Academics"/>
        <content>        
             
<widget id="1218"></widget>
        </content>
      <!-- Else,  include the title heading and links to the previous and next story-->

    <else content="true">
        
<content>
             <h1 class="title"><xphp var="group_title"/></h1>
             <div
class="left arrow ir">Previous Story</div>
             <div
class="right arrow ir">Next Story</div>
        </content>
    </else>
</xphp>

eb8f96c071020d8b0923da726d6cab65@livewhale.desk-mail.com
https://cdn.desk.com/
false
desk
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
false
Invalid characters found
/customer/en/portal/articles/autocomplete?b_id=4256