Copied to clipboard

Flag this post as spam?

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


  • Peter Jensen 32 posts 137 karma points
    Oct 27, 2014 @ 13:32
    Peter Jensen
    0

    Pseoudo nodes

    Hey All 

    Today i was taskede with removing all employee nodes under a uk website, and make a "pseodu resolver" that could find the "danish" employee node in the danish content tree and present that. instead  
    (basicly they want to sync there members in so now i they have tabs for dk and uk)

    I createde a IContentFinder 

     public bool TryFindContent(PublishedContentRequest contentRequest)
            {
                var urlParts = contentRequest.Uri.GetAbsolutePathDecoded().Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
                if (contentRequest.Culture.Name != "da-DK" && urlParts.Any() && urlParts[0].Equals("employees") && urlParts.Length > 1)
                {
                    var contentCache = contentRequest.RoutingContext.UmbracoContext.ContentCache;
                    var employees = contentCache.GetById(EmployeesId);
    
                    var employee = employees.Children.FirstOrDefault(e => e.UrlName == urlParts.LastOrDefault());
                    contentRequest.PublishedContent = employee;
                    contentRequest.Culture = new CultureInfo("en-US");
                    return true;
    
                }
    
                return false;
            }

    But no matter how i return the content node it is returned as da-DK and the menu changes to show all the danish nodes. 

    How would i get arround umbraco setting the culture based on where the node lives ? 

     

  • Stephen 767 posts 2273 karma points c-trib
    Oct 27, 2014 @ 15:51
    Stephen
    0

    Just to make sure I understand it right: the "employee" node is below the da-DK part of the tree, right? And though the IContentFinder sets the culture to en-US, culture is later on reverted to da-DK ie to the original culture derived from (I presume) the hostname setting. Is that correct? As far as I can tell the IContentFinder is correct, no immediate issue that I can see. Only thing that could change the culture, is hostnames/cultures settings - could you describe them in more details? Ie which nodes hold hostnames / cultures?

  • Peter Jensen 32 posts 137 karma points
    Oct 27, 2014 @ 17:47
    Peter Jensen
    0

    Hey stephen 

    indeed i could, I got 2 sites at the root the the tree. 

    dk-site-home-node

    -- the dk site has and hostname site.dk and a culture da-DK
     -- and it is here the employees live


    uk-site-home-node 
    -- the uk site allso has and hostname site.com and a culture en-US

    the 2 sites have the same strucktures and shares temples. i can send u and email with a login to the test enviroment and all if u want.   

     

     

  • samyhrer 4 posts 24 karma points
    Dec 19, 2014 @ 08:41
    samyhrer
    0

    Peter:  I've got the same challenge/problem. Did you ever find a solution?

  • Simon Dingley 1470 posts 3427 karma points c-trib
    Jan 26, 2015 @ 15:21
    Simon Dingley
    0

    Did anyone find a solution to this?

    I also have a multi site/language solution and some content that resides in the UK site is to be made available on the other language versions without duplicating all of the content (~600 nodes). I have implemented a custom IContentFinder which resolves the content as expected however the content is presented in the context of the originating site e.g. the page is rendered as though you were on the UK site so we get all of the UK menus etc and not the ones from the current site e.g. French in which the content is being rendered. The content is also rendered with all of the absolute urls pointing to the originating site (e.g. UK) and not the current site (e.g. FR).

    Any pointers appreciated!

    Thanks, Simon

Please Sign in or register to post replies

Write your reply to:

Draft