Copied to clipboard

Flag this post as spam?

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


  • Frost 70 posts 99 karma points
    Oct 26, 2011 @ 02:33
    Frost
    0

    Location of Search Results for XSLTsearch

    I just plugged in XSLTsearch and it's working great! Thanks for putting this together.

    I've placed the search box on the sidebar of my webpage so that it appears next to all articles. When I perform a search, all the search results appear under the search box, still in the bar.

    Is there an easy way to open up another page to display search results? I imagine so, but can't quite connect the dots.

    The Search page (/search.aspx) that installed automatically in the content tree doesn't actually open, and I tried changing the source node referenced in the code

    umbraco:Macro source="1157"

  • Frost 70 posts 99 karma points
    Oct 26, 2011 @ 02:38
    Frost
    0

    None of those efforts worked, and any direction would be much appreciated! Thanks :)

  • wolulcmit 357 posts 693 karma points
    Oct 26, 2011 @ 03:20
    wolulcmit
    1

    I think you just have to get your search to post to the search page instead of itself for the functionality you're after.
    so your search form should look something like this:

    <form id="searchform" method="post" action="/search.aspx">
    <input name="search" id="search" type="text" placeholder="Enter a Search Term" />
    <input type="submit" value="Search" />
    </form>

    and then your 'search' node just needs to use the search template which contains the xslt search macro (also need to be saved and published).

    I think the source in this case is the top level node that you want Xslt to search within.

    Xslt search is brilliant eh!
    give Doug some Karma if you havent already

    - Tim

     

  • Frost 70 posts 99 karma points
    Oct 26, 2011 @ 22:15
    Frost
    0

    Thank you for your quick response! I tried karma-ing Doug, but my own apparently isn't high enough to count yet (!). I promise to go back once I'm over 70, like it says :) In the meantime, I'm sure we will work out some financial contribution once we get paid for the project that this is for.

    Down to Business

    Source does indeed seem to be the top level node, so that's good.

    I'm still (in true n00b fashion) having trouble understanding how the nifty code you provided gets worked into the template. I have the macro

     umbraco:Macro source="1157" searchFields="@nodeName,pageTitle,bodyText" previewFields="pageTitle,bodyText" searchBoxLocation="BOTTOM" previewType="BEGINNING" resultsPerPage="10" previewChars="200" showPageRange="1" showOrdinals="1" showScores="0" showStats="0" Alias="XSLTsearch" runat="server"

    and tried wrapping it with

    form method="get" action="search.aspx?"

    but results still appear on the original page. I'm going to poke around in the XSLT file and ask a couple guys in the office too, but would appreciate a little more guidance! Thank you :)

  • wolulcmit 357 posts 693 karma points
    Oct 28, 2011 @ 02:42
    wolulcmit
    0

    What happens when you hit your search page with something like the following?
    http://www.yoursite.com/search.aspx?search=enter-a-search-term-here

    that will determine at least whether your search template is working how you want it to

    as for your form tag, any reason why your trying to do a get rather than a post?
    does your input have the name search?
    like

    <inputname="search"id="search" type="text" />

    take off the runat=server tag from your form if you have one.
    maybe post the full code within and including the form tags here so it's a bit easier to see whats going on....

    - Tim

     

  • Frost 70 posts 99 karma points
    Nov 19, 2011 @ 00:06
    Frost
    0

    Thanks for the help on this ... I realized at one point that the XSLT search project page says it works well up to a couple thousand pages, and since we're going to be migrating over 30,000 I'll need to find something else, although I still wish we could have figured this one out! Thanks though :)

  • FarmFreshCode 225 posts 422 karma points
    Apr 03, 2013 @ 16:38
    FarmFreshCode
    0

    ********* UPDATED - I had comflicting code on my site that prevented this setup from working correctly, however if you follow the steps that I outlined here you should be able to drop in your search field anywhere you like on your site *********


    Hi everyone,

    I'm still having a little trouble with this topic. I tried to work off of wolulcmit's example but I don't seem to be getting it to work right. My goal is to have a search bar that I can easily place on different specific pages of my site that would allow people to search for this specific kind of result.... 

    SO...

    I set up a new XSLT file with clean macro. (ResearchInterestSearch.xslt)

    ****STANDARD STUFF ABOVE******

    <
    xsl:output method="xml" omit-xml-declaration="yes"/>
    <xsl:param name="currentPage"/>
    <xsl:template match="/">

      
    <form id="searchform" method="post" action="/faculty-research/search/">
    <input name="search" id="search" type="text" placeholder="Enter a Search Term" />
    <input type="submit" value="Search" />
    form>
      
    xsl:template>
    xsl:stylesheet>

    I enabled the corresponding macro to: Use in editor so that I could easily drop it inside my pages. 

    Then I created a page (/test/) on my site and added the above macro to this page via the WYSIWYG editor.

    Now, I also have a page /faculty-research/search/ which is where I want the results to be shown. On this page I have the XSLTsearch macro placed on the page via the WYSIWYG editor with these settings:

    <div umb_showstats="0" umb_previewfields="facultyintrestTAGS" umb_searchfields="@nodename,facultyintrestTAGS,facultyintrestemail,facultyintrestURL" umb_previewchars="0" umb_resultsperpage="15" umb_showscores="0" umb_macroalias="FacultyInterestXSLTsearch" umb_showpagerange="1" umb_source="" umb_searchboxlocation="TOP" umb_previewtype="BEGINNING" umb_showordinals="0" ismacro="true" onresizestart="return false;" umbversionid="0946e063-a2da-4a6f-bdb7-6d1fdb67b836" umbpageid="6270" title="This is rendered content from macro" class="umbMacroHolder"><!-- startUmbMacro -->
    <div id="xsltsearch" style="display: block; float: right; width: 455px;">
    <div class="xsltsearch_form"> </div>
    </div>
    <!-- endUmbMacro --></div>

    If I navigate directly to /faculty-research/search/ and search from there the results are pulled up great on that page... but I need to be able to search from other pages like /test/. I don't want the results to be shown on the other pages like /test/ or /contact/ ect... so I need a landing page for my results. Hopefully /faculty-research/search/ if we can make that work.

    Currently...

    When I visit /test/ and hit SEARCH the page refreshes, but no results are returned and the page doesn't move to the desired landing page of /faculty-research/search/

    Solution..?

    So what am I missing? I'm hoping to be able to just drop in a macro through the WYSIWYG editor on certain pages, as well as reference a macro on my homepage template.  Any additional information would be great to help me get past this little hurdle.

    THANKS!


  • FarmFreshCode 225 posts 422 karma points
    Apr 03, 2013 @ 17:10
    FarmFreshCode
    0

    **Update, I was reading more on this topic (here) and Doug mentions that you can't have a <form> inside another <form>. As Doug mentions "That's a problem with asp.net generally, not XSLTsearch." So that might be my immediate problem...

    I noticed that when I viewed the generated source code of the /test/ page that no <form> </form> tags were generated around my search bar... thus why it's not redirecting to the results page probably..... HOWEVER.. if someone could please still read my set up and confirm that I have things in the right palce to do this.. that would help too.

    ...now off to try to figure out why I have my whole content area wrapped in a form tag... hmmmmmmm.

  • wolulcmit 357 posts 693 karma points
    Apr 03, 2013 @ 17:13
    wolulcmit
    0

    My first guess is check that your form tags are being rendered correctly from your /test/ page
    perhaps its getting mangled once the WYSWYG editor gets a hold of it.
    If so you may need to move your form tags out of your ResearchInterestSearch.xslt macro and into the masterpage for that template to surround the richtext field that you're trying to render (hope that makes sense)

    - Tim

  • FarmFreshCode 225 posts 422 karma points
    Apr 03, 2013 @ 17:34
    FarmFreshCode
    0

    Hi Tim, 

    I hope that won't be the case. I really only want to have this search bar on like 3 pages. I would certainly prefer not to have it in the template for which I have hundreds of pages that use that template... nor would I like to create a whole new template to accomodate using this search feature.

    I'll see what happens once I figure out why I have a <form> inside a <form>. Hopefully, the inner one is getting stripped out automatically..

    Does anyone have <form> tags in the .XSLT files that are used with macros place in the WYSIWYG editor? That would certainly be helpful to know if it's possible...


  • FarmFreshCode 225 posts 422 karma points
    Apr 03, 2013 @ 17:56
    FarmFreshCode
    0

    **Update,.. I commented out the <form runat="server"> code in my template that I have wrapping around my main content area and things immediately worked. My XSLT began rendering the

    <form id="searchform"method="post"action="/faculty-research/search/">

    just fine and the redirection to the results page worked great too!... So it looks like my solution above is all correct.


    ... I just need to remember why I had to wrap that content in a form tag... (completly unrelated issue) anyway... thanks! for everyones help on this post.. and the others that I read that helped get me through this issue today.

  • Ahmad 1 post 21 karma points
    Jan 21, 2014 @ 18:22
    Ahmad
    0

    on other page that you want to show result but the xslt umbraco macro between <form> here </form>

Please Sign in or register to post replies

Write your reply to:

Draft