7.0

Table Of Contents
The template file
In the content area of the template file (template-storefront_overview.php) an input field is added. The
getTree() function is added to the onkeyup event of the <input> field. This event is triggered when the user
presses, and releases a key in the input field.
<div id="content">
<div class="search" style="border:1px solid silver;width:250px;margin-bottom:0.5em;">
<div id="cSearchHeader" class="formHeader">Search</div>
<div style="padding: 4px;">
<p><b>Pub type or document name:</b></p>
<input style="
background-image:url('<? generateSkinLocation(); ?>/
storefront_tree_search/images_tree/throbber.gif');
background-repeat:no-repeat;background-position:100% 2px;
width:220px;margin-top:0.5em;" id="searchfor" onkeyup="getTree(this.value)"/>
</div>
</div>
<div id="tree"></div>
</div>
Livesearch.php
The PHP page called by the JavaScript code is called "livesearch.php". The code retrieves the publication types
and templates on the server based by the search string entered by the visitor.
The getTree() accepts a search string parameter (getTree('cards')). The getTree() function returns a list of
publication types and documents where the case sensitive search string appears at least in one of the fields:
Document name
Document code
Publication type name
Publication type code
The search result is used to create an hierchical tree using unorderedlists (<ul>). The response is used by the
getList() function
Customizing the store front - Adding a live search option
Objectif Lune Inc. © 2010 59