Copied to clipboard

Flag this post as spam?

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


  • Djan Blom 99 posts 161 karma points
    Jul 27, 2011 @ 23:33
    Djan Blom
    0

    Need a little help setting up Xslt Search.

    Hi, I'm not really good at XSLT - but I really need the search bar on my portfolio to work, so I hope someone can give me a hand with this.. :)

    http://www.omniscience.dk/

    If I use the search in top of my page, it doesnt redirect to /search.aspx - why/how?

    http://www.omniscience.dk/Search.aspx

    It seems to go to "search.aspx" instead of "Search.aspx" - can someone tell me how/where in Xslt-code I set this ? (or where ever).

    Thanks guys.

    XSLTsearch ver. 3.0 and umbraco 4.7

  • Fuji Kusaka 2203 posts 4220 karma points
    Jul 28, 2011 @ 04:57
    Fuji Kusaka
    0

    Hi Djan,

    I think you have miss a step somewhere in there. Anyways to get the search results to the search.aspx page you need to add a form in your master or whatever main template you are using like this:

     <div id="xsltsearch">
    <div class="xsltsearch_form">
    <form method="post" action="search.aspx?">
      <input name="search" type="text" class="input" value="" />
       <input type="submit" class="submit" value="Search" />
    </form>
    </div>
    </div>

    Remember to do the same in your XSLT Search Template for the top Search box to work and whats left to do is insert your macro 

    <form method="get" action="search.aspx?">
                      <umbraco:Macro source="-1" searchFields="@nodeName,mainBodyText,metaDescription,metaKeywords," previewFields="mainBodyText,metaDescription" searchBoxLocation="None" previewType="Beginning" resultsPerPage="10" previewChars="225" showPageRange="1" showOrdinals="1" showScores="0" showStats="0" Alias="XSLTsearch" runat="server" />
    </form>

    Hope it helps

     

    //fuji

     

  • Djan Blom 99 posts 161 karma points
    Aug 12, 2011 @ 23:33
    Djan Blom
    0

    Hi Fuji,

    Sorry it took so long to answer.

    Do I need to change anything in the XSLT file? If so, I can figure out where.
    If I only can have one form-tag on a page, why is that? (and can I just the all the content inside a form-tag? )

     

    here's what it looks like. it does redirect - but also shows the results in the top-bar?

    thanks

  • Fuji Kusaka 2203 posts 4220 karma points
    Aug 13, 2011 @ 07:33
    Fuji Kusaka
    0

    Hey Djan,

    Just remove the macro at the top of your page where you added the Input Filed, assuming you only want the results to be displayed in the content area.

     

    Remove this part at top
    <form method="get"action="search.aspx?">
                      <umbraco:Macrosource="-1"searchFields="@nodeName,mainBodyText,metaDescription,metaKeywords,"previewFields="mainBodyText,metaDescription"searchBoxLocation="None"previewType="Beginning"resultsPerPage="10"previewChars="225"showPageRange="1"showOrdinals="1"showScores="0"showStats="0"Alias="XSLTsearch"runat="server"/>
     
    form>

     
    //fuji

     

     

     

  • Djan Blom 99 posts 161 karma points
    Aug 13, 2011 @ 09:37
    Djan Blom
    0

    Hi Fuji,

    It works, eureka! :D thanks a lot, that really helped me out a lot - actually also in understanding the package better :)

    Take care,

    /Djan

  • Djan Blom 99 posts 161 karma points
    Aug 13, 2011 @ 10:28
    Djan Blom
    0

    Well, I have another question - how do I make it "not search" in the hidden pages? Its not supposed to do that.. :P

    thanks, Djan

  • Fuji Kusaka 2203 posts 4220 karma points
    Aug 14, 2011 @ 20:33
    Fuji Kusaka
    0

    Hey Djan, 

    Yes this is possible, so you dont want to show results of nodes which are hidden?

    What you can do is look for this variable in your XSLT Search Macro

     

    <xsl:variable name="possibleNodes" select="$items/descendant-or-self::node[

     

     

    and replace this  part with the document type your are using to hide your nodes
     

    <!-- reduce the number of nodes -->
    <xsl:variable name="possibleNodes" select="$items/descendant-or-self::node[
         string(data [@alias='searchHide']) != '1'
         and count(attribute::id)=1 
         and (umbraco.library:IsProtected(@id, @path) = false()
         or umbraco.library:HasAccess(@id, @path) = true())
        ]"/>
    ...

     

    //fuji

     

Please Sign in or register to post replies

Write your reply to:

Draft