<h4>Smarty Usable Class</h4>
<p>When this module is installed, a new smarty class named smx is automatically available to your page templates and various module templates.  This smarty class has numerous functions that you can call at any time.</p>
<h5>Available Functions:</h5>
<ul>

<li><strong>xt_setvar</strong>(name=value [name2=value2[ name3=value3]])
   <p>For use when smarty variable scope is being problematic. This plugin will store data outside of smarty to allow that data to be recalled in a sub template or at a later place in the same template.</p>
   <p>Example:  <code>&#123;xt_setvar foo='bar' foo2='bar2' foo3='bar3'}</code></p>
   <br/>
</li>

<li><strong>xt_unsetvar</strong>(name=value [name2=value2 [name3=value3]])
   <p>For use when smarty variable scope is being problematic, this plugin allows erasing data that was created with the &#123;setvar} plugin.</p>
   <p>Arguments:
      <ul>
        <li>unset - required : A comma separated string of the names of data previously created with <code>&#123;setvar}</code></li>
      </ul>
  </p>
  <p>Example:  <code>&#123;xt_unsetvar unset='foo2,foo3'}</code></p>
   <br/>
</li>

<li><strong>xt_getvar</strong>(var=name [dflt=value] [assign=name [scope=global|local]])
  <p>For use when smarty variable scope is being problematic.  This plugin will retrieve data previously created with the &#123;setvar} plugin.  You can optionally assign the data to a new local, or global smarty variable.</p>
  <p>Arguments:
     <ul>
       <li>v|var  - required : The name of the stored data to retrieve.</li>
       <li>dflt   - optional : A value to return if the named variable specified in the var argument does not exist.</li>
       <li>assign - optional : Instead of returning the output data assign the data to the named sparty variable.</li>
       <li>scope  - optional : For use only when the assign argument is used, additionally assign the output data to a smarty variable to the global scope.</li>
     </ul>
  </p>
  <p>Example1 - Output a previously set variable to the template: <code>&#123;xt_getvar var=foo}</code></p>
  <p>Example2 - Output a previously set variable to the template.  If it does not exist, use a default value.: <code>&#123;xt_getvar var=foo dflt='something'}</code></p>
  <p>Example3 - Output a previously set variable to a local smarty variable: <code>&#123;xt_getvar var=foo assign='foo'}&#123;$foo}</code></p>
  <p>Example4 - Output a previously set variable to a global smarty variable: <code>&#123;xt_getvar var=foo assign='foo' scope='global'}&#123;$foo}</code></p>
  <br/>
</li>


<br/>
<li><strong>smx::self_url</strong>()
    <p>Return the current URL</p>
</li>

<br/>
<li><strong>smx::anchor_url</strong>($name)
  <p>Generate the absolute URL to an anchor that is on the same page.</p>
  <p>Arguments:
    <ul>
      <li>$name - The name of the anchor to link to.</li>
    </ul>
  <br/></p>
  <p>Example:<br/>
    <pre>&lt;a href="&#123;smx::anchor_url('bottom')}"&gt;Go to the bottom&lt;/a&gt;
&lt;a name="bottom"&gt;The bottom&lt;a&gt;</pre><br/>
  </p>
</li>

<br/>
<li><strong>smx::module_installed</strong>($modulename)
    <p>Test if a particular module is installed.</p>
    <p>Arguments:
       <ul>
         <li>$modulename - The name of the module to check</li>
      </ul>
    <br/></p>
  <p>Example:<br/>
    <pre>&#123;if smx::module_installed('FrontEndUsers')}Found FEU&#123;/if}</pre><br/>
  </p>
</li>

<br/>
<li><strong>smx::module_version</strong>($modulename)
    <p>Return the version number of a specific installed module</p>
    <p>Arguments:
       <ul>
         <li>$modulename - The name of the module to check</li>
      </ul>
    <br/></p>
  <p>Example:<br/>
    <pre>&#123;$version=smx::module_version('FrontEndUsers')}We have Version &#123;$feu_version} of FrontEndUsers</pre><br/>
  </p>
</li>

<br/>
<li><strong>smx::get_parent_alias</strong>([$alias])
    <p>Returns the alias of the specified pages parent. Returns an empty string if there is no parent.</p>
    <p>Arguments:
       <ul>
       <li>[$alias] - (optional) The page alias to find the parent of.  If no value is specified, the current page is used.</li>
       </ul>
    <br/></p>
  <p>Example:<br/>
    <pre>The parent page alias is &#123;smx::get_parent_alias()}</pre><br/>
  </p>
</li>

<br/>
<li><strong>smx::is_child_of</strong>($test_parent,$test_child)
    <p>Tests whether or not the specified child alias or ancestor is a child of the specified parent alias.
       This function can be used to test the root alias or any parent page.  It is particularly useful on sites with multiple levels of organization.
    </p>
    <p>Arguments:
       <ul>
       <li>$test_parent - string The parent page alias to test against.</li>
       <li>$test_child - string The child page alias to test against.</li>
       </ul>
    <br/></p>
  <p>Example:<br/>
    <pre>&#123;if smx::is_child_of('home',$page_alias)} This is a child of the home page &#123;/if}</pre><br/>
  </p>
</li>

<br/>
<li><strong>smx::get_root_alias</strong>([$alias])
    <p>Returns the alias of the specified pages root parent. Returns an empty string if there is no root parent.</p>
    <p>Arguments:
       <ul>
       <li>[$alias] - (optional) The page alias to find the root parent of.  If no value is specified, the current page is used.</li>
       </ul>
    <br/></p>
  <p>Example:<br/>
    <pre>The root parent page alias is &#123;smx::get_root_alias()}</pre><br/>
  </p>
</li>

<br/>
<li><strong>smx::get_page_title</strong>([$alias])
    <p>Returns the title of the specified page.</p>
    <p>Arguments:
       <ul>
       <li>[$alias] - (optional) The page alias to find the title of.  If no value is specified, the current page is used.</li>
       </ul>
    <br/></p>
  <p>Example:<br/>
    <pre>The title of the current page is &#123;smx::get_page_title()}</pre><br/>
  </p>
</li>

<br/>
<li><strong>smx::get_page_menutext</strong>([$alias])
    <p>Returns the menutext of the specified page.</p>
    <p>Arguments:
       <ul>
       <li>[$alias] - (optional) The page alias to find the title of.  If no value is specified, the current page is used.</li>
       </ul>
    <br/></p>
  <p>Example:<br/>
    <pre>The menutext of the current page is &#123;smx::get_page_menutext()}</pre><br/>
  </p>
</li>

<br/>
<li><strong>smx::get_page_type</strong>([$alias])
    <p>Returns the name of the content type of the specified content object (by alias)</p>
    <p>Arguments:
       <ul>
       <li>[$alias] - (optional) The page alias to find the title of.  If no value is specified, the current page is used.</li>
       </ul>
    <br/></p>
  <p>Example:<br/>
    <pre>The type of the current page is &#123;smx::get_page_type()}</pre><br/>
  </p>
</li>

<br/>
<li><strong>smx::has_children</strong>([$alias])
    <p>Test if the specified page has children.</p>
    <p>Arguments:
       <ul>
       <li>[$alias] - (optional) The page alias to test.  If no value is specified, the current page is used.</li>
       </ul>
    <br/></p>
  <p>Example:<br/>
    <pre>&#123;$has_children=smx::has_children()}&#123;if $has_children}The current page has children&#123;else}The current page has no children&#123;/if}</pre><br/>
  </p>
</li>

<br/>
<li><strong>smx::get_children</strong>([$alias][,$showinactive])
   <p>Return an array containing information about a pages children (if any)</p>
    <p>Arguments:
       <ul>
       <li>[$alias] - (optional) The page alias to test.  If no value is specified, the current page is used.</li>
       <li>[$showinactive] - (optional) Wether inactive pages should be included in the result (defaults to false).</li>
       </ul>
    <br/></p>
  <p>Fields:
       <ul>
       <li>alias - the page alias of the child</li>
       <li>id - the page id of the child</li>
       <li>title - the title page of the child page.</li>
       <li>menutext - the menu text of the child</li>
       <li>show_in_menu - wether this child page is visible in menus.</li>
       <li>type - The type of child content object.</li>
       </ul>
    <br/></p>
  <p>Example:<br/>
    <pre>
&#123;$children=smx::get_children()}
      &#123;if count($children)}
        &#123;foreach from=$children item='child'}
          &#123;if $child.show_in_menu}
            Child:  id = &#123;$child.id} alias = &#123;$child.alias}&lt;br/&gt;
          &#123;/if}
        &#123;/foreach}
      &#123;/if}
    </pre><br/>
  </p>
</li>

<br/>
<li><strong>smx::get_page_content</strong>($alias[,$block])
    <p>Returns the text of a specific content block of another page.</p>
    <p>Arguments:
       <ul>
       <li>$alias - The page alias to extract content from.</li>
       <li>[$block] - (optional) The name of the content block in the specified page.  If this variable is not specified the value of the default content block <em>(content_en)</em> is assumed.</li>
       </ul>
    <br/></p>
  <p>Example:<br/>
    <pre>The 'second' block of the 'about' page is &#123;$foo=smx::get_page_content('about','second')}&#123;eval var=$foo}</pre><br/>
  </p>
</li>

<br/>
<li><strong>smx::get_sibling</strong>($direction,$alias)
    <p>Returns the alias of the next or previous sibling to the specified
       page. or false.</p>
    <p>Arguments:
       <ul>
       <li>$direction - the direction to look in.  possible values are prev,previous,-1,next,1</li>
       </ul>
    <br/></p>
  <p>Example:<br/>
       <pre>Link to previous sibling: &#123;$prev_sibling=smx::get_sibling(&quot;prev&quot)}&#123;if !empty($prev_sibling)}&#123;cms_selflink page=&quot;$prev_sibling&quot; text=&quot;Previous&quot;}&#123;/if}</pre><br/>
    </li>

<br/>
<li><strong>smx::get_parallel_page</strong>($new_root[,$current_page = null])
   <p>Get the alias of a parallel page in the page stricture given a different root alias.</p>
   <p>In a multilanguage site where the root levels represent different languages, it may be useful to retrieve the alias to an equivalent page in a different language.  i.e.: if the user is currently browsing the french page and wishes to see the same page in english (if it exists).</p>
   <p>This function returns the alias of the specified page under the new root.  If it exists.  If nothing is found, null is returned.</p>
   <p>Arguments:
       <ul>
       <li>new root - The alias of the new root parent.  Note, if a top level page is not specified, the alias provided is used to find the top level page (see get_root_alias).</li>
       <li>current_page - (optional) The page alias to find the peer of.  If no value is specified, the current page is used.</li>
       </ul>
    <br/></p>
  <p>Example:<br/>
    <pre>Find the equivalent french page for this page: &#123;$tmp=smx::get_parallel_page('FR')}&#123;if $tmp != '' && $tmp != $page_alias}&#123;cms_selflink page=$tmp}&#123;/if}</pre>
  </p>
</li>

<br/>
<li><strong>smx::get_parallel_url</strong>($new_root[,$current_page = null])
   <p>Get the URL of a parallel page in the page stricture given a different root alias.</p>
   <p>In a multilanguage site where the root levels represent different languages, it may be useful to retrieve the URL to an equivalent page in a different language.  i.e.: if the user is currently browsing the french page and wishes to see the same page in english (if it exists).</p>
   <p>This function returns the alias of the specified page under the new root.  If it exists.  If nothing is found, null is returned.</p>
   <p>Arguments:
       <ul>
       <li>new root - The alias of the new root parent.  Note, if a top level page is not specified, the alias provided is used to find the top level page (see get_root_alias).</li>
       <li>current_page - (optional) The page alias to find the peer of.  If no value is specified, the current page is used.</li>
       </ul>
    <br/></p>
  <p>Example:<br/>
    <pre>Find the equivalent french page for this page: &#123;$url=smx::get_parallel_page('FR')}&#123;if $url}<a href="&#123;$url}">FR</a>&#123;/if}</pre>
  </p>
</li>

<br/>
<li><strong>smx::get_file_listing</strong>($dir[,$excludeprefix])
    <p>Retrn a list of files in a directory.</p>
    <p>Arguments:
      <ul>
      <li>$dir - Te directory to scan (should be an absolute directory)</li>
      <li>[$excludeprefix] - (optional) Exclude files strting with the specified prefix.</li>
      </ul>
  </p>
</li>
</ul>