|
ParametricNavigationInstallationGSAv5
Parametric Navigation Installation Instructions - version 1.5.4 (GSA v5.0)
Featured IntroductionThis page contains the installation instructions for the GSA parametric navigation. All the appropriate files can be found in the zip file that is available in the downloads section. DetailsInstallation Instructions: ==> NOTE: Google does not warranty or in any way guarantee the reliability of this code. Use it at your own risk. ==>NOTE: Before starting, it is important to use the parameter proxyreload=1 in your browser's URL line (for the search URL) in order to make sure that any changes to a stylesheet are reflected immediately. Step 1In the "Other variables (can be customized)" section of the xslt, place the following lines:
<!-- *** parametric navigation options *** --> <xsl:variable name="show_parametric_navigation">1</xsl:variable>
Step 2Create the following xsl template, before the "My global page header/footer (can be customized)" section:
<!-- **********************************************************************
My parametric navigation (can be customized)
********************************************************************** -->
<xsl:template name="my_parametric_navigation">
<span class="p">
<xsl:text disable-output-escaping="yes"> <!-- Please enter html code below. --></xsl:text>
<!-- ********************************************************************** -->
<div name="mtParametric" id="mtParametric"><font size="1"><br/><br/><br/><br/>
   Loading parametric...</font></div>
<!-- ********************************************************************** -->
</span>
</xsl:template>
Step 3In the "Global Style (do not customize" section, before the </xsl:comment> tag, put in the following lines:
<xsl:if test="$show_parametric_navigation = '1'">
<!-- ************************************************************* -->
<!-- CUSTOM : Metatag Clustering specific style
*************************** -->
div#metaclustering { font-size: 84%; line-height: 140%; float: right; width: 15em; margin: 1em 0 0 1em; padding-left: 1em; border-left: 1px solid #cccccc; }
div#metaclustering h3 { font-size: 100%; font-weight: bold; margin: 1.2em 0 0.6em 0; padding: 0; }
div#metaclustering ul { list-style: none; margin: 0; padding: 0; }
div#metaclustering li { margin-left: 2em; text-indent: -2em; }
#metacluster_message { color: #666666; }
<!-- ************************************************************* -->
</xsl:if>
Step 4In the "Search results (do not customize)" section, change the following:
<xsl:choose>
<xsl:when test="$show_res_clusters = '1'">
<script language='javascript' src='common.js'></script>
<script language='javascript' src='xmlhttp.js'></script>
<script language='javascript' src='uri.js'></script>
<script language='javascript' src='cluster.js'></script>
<body onLoad="resetForms(); cs_loadClusters('{$search_url}', cs_drawClusters);" dir="ltr">
<xsl:call-template name="search_results_body"/>
</body>
</xsl:when>
<xsl:otherwise>
<body onLoad="resetForms()" dir="ltr">
<xsl:call-template name="search_results_body"/>
</body>
</xsl:otherwise>
</xsl:choose>
TO:
<xsl:choose>
<xsl:when test="$show_res_clusters = '1' or $show_parametric_navigation = '1'">
<script language='javascript' src='common.js'></script>
<script language='javascript' src='xmlhttp.js'></script>
<script language='javascript' src='uri.js'></script>
<script language='javascript' src='cluster.js'></script>
<xsl:if test="$show_parametric_navigation = '1'">
<!-- Parametric Navigation code start -->
<script language='javascript' src='http://YOUR_HOST/googleParametric.js'>//Comment</script>
<!-- Parametric Navigation code end -->
</xsl:if>
<xsl:if test="$show_res_clusters = '1' and $show_parametric_navigation = '1'">
<body onLoad="resetForms(); cs_loadClusters('{$search_url}', cs_drawClusters); mTLoad('mtParametric', '{$search_url}', 1);" dir="ltr">
<xsl:call-template name="search_results_body"/>
</body>
</xsl:if>
<xsl:if test="$show_res_clusters = '1' and $show_parametric_navigation != '1'">
<body onLoad="resetForms(); cs_loadClusters('{$search_url}', cs_drawClusters);" dir="ltr">
<xsl:call-template name="search_results_body"/>
</body>
</xsl:if>
<xsl:if test="$show_res_clusters != '1' and $show_parametric_navigation = '1'">
<body onLoad="resetForms(); mTLoad('mtParametric', '{$search_url}', 1);" dir="ltr">
<xsl:call-template name="search_results_body"/>
</body>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<body onLoad="resetForms()" dir="ltr">
<xsl:call-template name="search_results_body"/>
</body>
</xsl:otherwise>
</xsl:choose>
Step 5At this point, you can either decide to have the javascript for parametric navigation, loaded from a remote location, or internally to the XSLT. If you choose from a remote location, then change the value YOUR_HOST in the following line (as inserted into the XSLT in Step 4):
<script language='javascript' src='http://YOUR_HOST/googleParametric.js'>//Comment</script>
to the hostname and path where you have placed the googleParametric.js file. Otherwise, you must replace the following line:
<script language='javascript' src='http://YOUR_HOST/googleParametric.js'>//Comment</script>
with the contents of the googleParametricInclude.txt file. Step 6Place any other parametric navigation function calls that are required, before the mTLoad statement, which were put into the XSLT in Step 4. NOTE: If you do not add in any mTAddField calls, then all the parametric fields and their values will be displayed. If you wish only specific parametric fields to be displayed, use the mTAddField function call, as follows:
// mTAddField(metaTagName, metaTagDelimiter);
mTAddField('keywords', ',');
==>NOTE: You must supply a delimiter which is not an empty value. By default, the label for a parametric field will be it's name. If you wish to name the Label for a specific parametric field, then the mTSetDisplayName function will need to be used, as follows:
// mTSetDisplayName(metaTagName, metaTagLabel);
mTSetDisplayName('keywords', 'Keywords');
For more information on the list of available functions and their description, please see the parametric navigation documentation or the readme.txt file. Step 7Modify the following:
<!-- **********************************************************************
Logo template (can be customized)
********************************************************************** -->
<xsl:template name="logo">
<a href="{$home_url}"><img src="{$logo_url}"
width="{$logo_width}" height="{$logo_height}"
alt="Go to Google Home" border="0" /></a>
</xsl:template>
to:
<!-- **********************************************************************
Logo template (can be customized)
********************************************************************** -->
<xsl:template name="logo">
<a href="{$home_url}"><img src="{$logo_url}"
width="{$logo_width}" height="{$logo_height}"
alt="Go to Google Home" border="0" onClick="clearAllCookies()" /></a>
</xsl:template>
in order to make your logo clear all set parametric cookies. Step 8Call the my_parametric_navigation template:
<!-- for parametric navigation -->
<xsl:if test="$show_parametric_navigation = '1'">
<xsl:call-template name="my_parametric_navigation">
</xsl:call-template>
</xsl:if>
wherever you want to display the parametric navigation results. In order to find the location that you wish, it is suggested that you look in the vicinity of "Output all results". Here is an example of a results template with parametric navigation embedded:
<!-- **********************************************************************
Output all results
********************************************************************** -->
<xsl:template name="results">
<xsl:param name="query"/>
<xsl:param name="time"/>
<!-- *** Add top navigation/sort-by bar *** -->
<xsl:if test="($show_top_navigation != '0') or ($show_sort_by != '0')">
<xsl:if test="RES"> <!-- there might be onebox results but no RES -->
<table width="100%">
<tr>
<xsl:if test="$show_top_navigation != '0'">
<td align="left">
<xsl:call-template name="google_navigation">
<xsl:with-param name="prev" select="RES/NB/PU"/>
<xsl:with-param name="next" select="RES/NB/NU"/>
<xsl:with-param name="view_begin" select="RES/@SN"/>
<xsl:with-param name="view_end" select="RES/@EN"/>
<xsl:with-param name="guess" select="RES/M"/>
<xsl:with-param name="navigation_style" select="'top'"/>
</xsl:call-template>
</td>
</xsl:if>
<xsl:if test="$show_sort_by != '0'">
<td align="right">
<xsl:call-template name="sort_by"/>
</td>
</xsl:if>
</tr>
</table>
</xsl:if>
</xsl:if>
<!-- *** Handle OneBox results, if any ***-->
<xsl:if test="$show_onebox != '0'">
<xsl:if test="/GSP/ENTOBRESULTS">
<xsl:call-template name="onebox"/>
</xsl:if>
</xsl:if>
<table border="0" width="100%">
<tr>
<td valign="top">
<!-- *** Handle spelling suggestions, if any *** -->
<xsl:if test="$show_spelling != '0'">
<xsl:call-template name="spelling"/>
</xsl:if>
<!-- *** Handle synonyms, if any *** -->
<xsl:if test="$show_synonyms != '0'">
<xsl:call-template name="synonyms"/>
</xsl:if>
<!-- *** Output Google Desktop results (if enabled and any available) *** -->
<xsl:if test="$egds_show_desktop_results != '0'">
<xsl:call-template name="desktop_results"/>
</xsl:if>
<!-- *** Output results details *** -->
<xsl:if test="$show_res_clusters = '1'">
<div id='clustering'>
<h3>Narrow your search</h3>
<span id='cluster_status'>
<span id='cluster_message' style="display:none">Loading...</span>
<noscript>
Javascript must be enabled for narrowing.
</noscript>
</span>
<xsl:choose>
<xsl:when test="$res_cluster_position = 'top'">
<table>
<tr>
<td id='cluster_label0'></td>
<td id='cluster_label2'></td>
<td id='cluster_label4'></td>
<td id='cluster_label6'></td>
<td id='cluster_label8'></td>
</tr>
<tr>
<td id='cluster_label1'></td>
<td id='cluster_label3'></td>
<td id='cluster_label5'></td>
<td id='cluster_label7'></td>
<td id='cluster_label9'></td>
</tr>
</table>
</xsl:when>
<xsl:when test="$res_cluster_position = 'right'">
<ul>
<li id='cluster_label0'></li>
<li id='cluster_label1'></li>
<li id='cluster_label2'></li>
<li id='cluster_label3'></li>
<li id='cluster_label4'></li>
<li id='cluster_label5'></li>
<li id='cluster_label6'></li>
<li id='cluster_label7'></li>
<li id='cluster_label8'></li>
<li id='cluster_label9'></li>
</ul>
</xsl:when>
</xsl:choose>
</div>
</xsl:if>
<div>
<!-- for keymatch results -->
<xsl:if test="$show_keymatch != '0'">
<xsl:apply-templates select="/GSP/GM"/>
</xsl:if>
<!-- for real results -->
<xsl:apply-templates select="RES/R">
<xsl:with-param name="query" select="$query"/>
</xsl:apply-templates>
<!-- *** Filter note (if needed) *** -->
<xsl:if test="(RES/FI) and (not(RES/NB/NU))">
<p>
<i>
In order to show you the most relevant results, we have omitted some entries very similar to the <xsl:value-of select="RES/@EN"/> already displayed.<br/>If you like, you can <a href="{$filter_url}0"> repeat the search with the omitted results included</a>.
</i>
</p>
</xsl:if>
</div>
</td>
<td valign="top" width="25%">
<!-- for parametric navigation -->
<xsl:if test="$show_parametric_navigation = '1'">
<xsl:call-template name="my_parametric_navigation">
</xsl:call-template>
</xsl:if>
</td>
</tr>
</table>
<!-- *** Add bottom navigation *** -->
<xsl:variable name="nav_style">
<xsl:choose>
<xsl:when test="($access='s') or ($access='a')">simple</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$choose_bottom_navigation"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:call-template name="google_navigation">
<xsl:with-param name="prev" select="RES/NB/PU"/>
<xsl:with-param name="next" select="RES/NB/NU"/>
<xsl:with-param name="view_begin" select="RES/@SN"/>
<xsl:with-param name="view_end" select="RES/@EN"/>
<xsl:with-param name="guess" select="RES/M"/>
<xsl:with-param name="navigation_style" select="$nav_style"/>
</xsl:call-template>
<!-- *** Bottom search box *** -->
<xsl:if test="$show_bottom_search_box != '0'">
<xsl:call-template name="bottom_search_box"/>
</xsl:if>
</xsl:template>
|