Copied to clipboard

Flag this post as spam?

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


  • Fuji Kusaka 2203 posts 4220 karma points
    Feb 27, 2013 @ 10:38
    Fuji Kusaka
    0

    Changing Location in xslt source for Multinlingual Website

    Hi Guys,

    I have a multilingual website and using xslt search. What am trying to do here is to change the source for each of the langs present.

    Getting the same result under all different search though.

    my xslt

      <xsl:variable name="source" select="string(PS.XSLTsearch:getParameter(string(umbraco.library:GetDictionaryItem('[XSLTsearch]Source')), '0'))"/>

    template search

    source="0"    

    //fuji

  • Fuji Kusaka 2203 posts 4220 karma points
    Feb 27, 2013 @ 10:49
    Fuji Kusaka
    0

    When source is changed manually in template it gives the right output that is

      source="1462"    
  • Fuji Kusaka 2203 posts 4220 karma points
    Feb 27, 2013 @ 11:33
    Fuji Kusaka
    0

    Any guess what am doing wrong here?

    Ttied something like 

    <xsl:variable name="source" select="string(umbraco.library:GetDictionaryItem('[XSLTsearch]Source'))"/>
  • Fuji Kusaka 2203 posts 4220 karma points
    Feb 27, 2013 @ 12:01
    Fuji Kusaka
    0

    Seems like source is not changing at all in the search.

    When i tried this

     <xsl:variable name="source" select="string(PS.XSLTsearch:getParameter(string(umbraco.library:GetDictionaryItem('[XSLTSearch]Source')), '1'))"/>

    and tries to output

    <xsl:value-of select="$source"/> // its giving me the value from my Dictionary Item but not giving any result from that node
  • Douglas Robar 3570 posts 4671 karma points MVP ∞ admin c-trib
    Feb 27, 2013 @ 14:26
    Douglas Robar
    0

    Hi, Fuji,

    Looks like you're trying to change the 'source' variable based on a dictionary key. That's a unique approach and shouldn't be needed at all.

    http://blog.percipientstudios.com/2010/11/17/quick-and-easy-multi-lingual-search-pages-for-umbraco-sites.aspx explains how to set up your multi-lingual sites to search each language site conveniently with XSLTsearch. Really simple.

    The only other thing you might want to consider is if you want XSLTsearch to always search within absolutely every page of your site, even when using multi-lingual sites or to only search within the site which has the search page in it (this is the default and the approach used in the blog post above).

    cheers,
    doug. 

  • Fuji Kusaka 2203 posts 4220 karma points
    Feb 27, 2013 @ 14:43
    Fuji Kusaka
    0

    Hi Doug,

    Am using the ultimate site structure for my multilingual website.

    - Content
    -- My Website Config
    --- EN
    --- FR
    --- DE
    --- RU

    Under each of the langs website all hostnames have already been set up, and all 4 have their own search.aspx page.

    What i would like is to be able to search only within the (EN)  content if am using the English version of the website. This works well if i only insert my macro in my template and hardcode the id of EN, but then i wont get the expected results when am on the other versions.

      source="1462" / /EN

    Now if i search through the entire website and am on DE i might be getting the result from a phrase which is on FR and on clicking am no more on the DE Website!

    source="-1" 

     

     

  • Douglas Robar 3570 posts 4671 karma points MVP ∞ admin c-trib
    Feb 27, 2013 @ 15:00
    Douglas Robar
    100

    Thanks for the clarity on the site structure... that will be a problem with the way XSLTsearch determines which part of the content tree to search within. By default it looks for all pages that share the same node at level=1. Normally this is the root of each site but you've added an intermediate level with the 'My Website Config' node. So we'll need to modify XSLTsearch to stop at level=2, which is easily done in the xsltsearch.xslt file:

    Change this:

    <xsl:call-template name="search">
      <!-- searches absolutely all pages (useful if you want to search multiple sites at once, or if you do not have all your content pages below a common homepage node in the content tree)
      <xsl:with-param name="items" select="umbraco.library:GetXmlAll()/*"/>
      -->
      <!-- searches all pages within a specific site (useful if you have multiple sites in one umbraco installation) -->
      <xsl:with-param name="items" select="$currentPage/ancestor-or-self::* [@level = '1']"/>
    </xsl:call-template>
    

    to this to support your site structure (see the bold item for @level = '2' ):

    <xsl:call-template name="search">
      <!-- searches absolutely all pages (useful if you want to search multiple sites at once, or if you do not have all your content pages below a common homepage node in the content tree)
      <xsl:with-param name="items" select="umbraco.library:GetXmlAll()/*"/>
      -->
      <!-- searches all pages within a specific site (useful if you have multiple sites in one umbraco installation) -->
      <xsl:with-param name="items" select="$currentPage/ancestor-or-self::* [@level = '2']"/>
    </xsl:call-template>
    

    cheers,
    doug. 

  • Fuji Kusaka 2203 posts 4220 karma points
    Feb 27, 2013 @ 16:07
    Fuji Kusaka
    0

    Thanks Doug,

    Finally got it working, I thought i could make use of the Dictionary Item for the source as well!...

    //fuji

  • Fuji Kusaka 2203 posts 4220 karma points
    Mar 01, 2013 @ 19:33
    Fuji Kusaka
    0

    Doug sometthing out of subject but interesting to talk over it. I have try to add an html tag in my input type search such as <a> and as you would expect got an ugly error page.

    Is there a way of encrypting the input text or may be making a javascript validation with regex ??

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies