Copied to clipboard

Flag this post as spam?

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


  • Alan Iroff 4 posts 24 karma points
    Jul 11, 2011 @ 17:07
    Alan  Iroff
    0

    Find pages by tags?

    I'd like to use XSLTsearch to find pages with the same tag.  I don't want to use a search box. 

    When I display the page, I'd like to show a list of pages with the list as part of the content of my page. (Think wiki - "related pages" or "similar topics").

    Using ver 4.7, XSLT 3.01.

    Can someone help me with this?

  • Douglas Robar 3570 posts 4671 karma points MVP 6x admin c-trib
    Jul 11, 2011 @ 17:32
    Douglas Robar
    0

    Hi, Alan,

    That would require a fair amount of re-work, but mostly simplification. The core logic of XSLTsearch is sill valid I think. 

    I can imagine two ways to handle this: add a tags textstring property to your document types, or add a tags (tags datatype) property to your document types.

    If you use a simple textstring to list the tags then no modification is needed to XSLTsearch. You'd only have to include the alias to the tags textstring in your XSLTsearch macro for the 'searchFields=' parameter. It'll then work.

    But of course you don't get the convenience of the tags datatype that way. If you use the tags datatype you'll need to change the selection mechanism (around line 150) to read the tags from the tags datatype. This video will help you understand the tags datatype and working with it in XSLT. 

    cheers,
    doug. 

  • Alan Iroff 4 posts 24 karma points
    Jul 11, 2011 @ 17:45
    Alan  Iroff
    0

    Thanks for the quick response Doug!  I've got a few more questions.

    If you included a link to a video, it's not appearing...

    Am I correct that if I change the lines that refer to "PS.XSLTsearch:getParameter(string(/macro/source)" or "umbraco.library:RequestForm('search')" that I don't have to do a submit?  The key thing here is that I want the list of pages to come up without the user dealing with a search box?

    I am using the default "Tags" data type, which stores a comma separated string.  Is this a problem for the search routine?

    If I make changes to xsltsearch.cs, do I have to compile the dll?

    Thanks for your help!

    Alan


  • Douglas Robar 3570 posts 4671 karma points MVP 6x admin c-trib
    Jul 12, 2011 @ 10:15
    Douglas Robar
    0

    The comma-separated string of the tags datat type will be fine and easy to search, just include the alias in the searchFields= parameter of the XSLTsearch macro. Sorry about the link to the tags datatype video, it is: http://umbraco.com/help-and-support/video-tutorials/umbraco-fundamentals/datatypes/using-the-tags-datatype

    The great thing about using a .cs file in the app_code folder is you don't need to compile anything - .net will do it for you automatically :)

    You can certainly modify XSLTsearch to do what you want, removing the code that shows the search form rather than results if there is no form submission or search term. 

    cheers,
    doug.

Please Sign in or register to post replies

Write your reply to:

Draft