Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • suzyb 463 posts 874 karma points
    Aug 10, 2011 @ 20:42

    Display search term and number of results

    I have some tracking code that needs the search term and number of results added to it.  The values are set in javascript like

    s.prop16 = 'my search term';
    s.prop28 = '10';

    But I am unsure how to get them from XSLTSearch to add them in my javascript at the bottom of my page body.

    Cany anyone help?

  • Douglas Robar 3570 posts 4671 karma points MVP 6x admin c-trib
    Aug 11, 2011 @ 16:34
    Douglas Robar

    All you need to do is add the following in the XSLTsearch.xslt file to update your javascript variable properties. Just insert this after XSLTsearch has calculated the results. I'd probably do it around line 218, just before the <div id="xsltsearch"> line.


    <script type="text/javascript">
    <xsl:text>s.prop16 = '</xsl:text><xsl:value-of select="$unescapedSearch"/><xsl:text>'; </xsl:text>
    <xsl:text>s.prop28 = '</xsl:text><xsl:value-of select="count($matchedNodes)"/><xsl:text>'; </xsl:text>


    I'm assuming the variables already exist but you can modify the above as needed now that you know how to do it.


  • suzyb 463 posts 874 karma points
    Aug 11, 2011 @ 21:52

    Thanks Doug.

Please Sign in or register to post replies

Write your reply to: