Our Forum has Moved

This site is our old forum and is only here for achive until we get proper 301 redirects setup to make Google happy.

Please use our new community site - Our Umbraco - which contains an improved forum, documentation wiki, package repository and a member locator.

Go to Our Umbraco now

Learn everything about Umbraco
Hostnames and niceurl Options
MichaelOlsen
Posted: Saturday, February 21, 2009 12:14:45 PM
Rank: Newbie

Joined: 9/21/2006
Posts: 16
Hi,

I'm running 4 sites in same umbraco instance, every site is configured with hostnames. NiceUrl dosent return "domainprefix" if the node is greather than level 2.

Domain prefixes is true, nodes have been republished like a million times.

What is the solution to this problem? I have seen others with the same issue on the forum, but there is no real solution in those threads.

Is there anyway to force to umbraco/niceurl to always use absolute urls?

Im using 3.0.6, figured I could download the source a modify niceurl - but VS2005 will not build the original source downloaded from codeplex.

Thanks
Michael
Spider
Posted: Thursday, March 05, 2009 4:06:18 AM
Rank: Devotee

Joined: 8/13/2008
Posts: 60
Location: New Zealand
Hi,

I'm having the same problem as well - anyone found a solution yet?

Cheers
Paul
mathijsuitmegen
Posted: Wednesday, December 09, 2009 11:49:00 AM
Rank: Newbie

Joined: 12/9/2009
Posts: 2
You could solve this using JavaScript and custom stylesheet classes.

I assume you have two separate Web sites (Site A & Site B) in one umbraco installation. Each site exists within separate nodes just below the content node.

You will have to setup a custom Stylesheet. Give your new class a proper name and set the 'Alias' to '.hyperlink_siteB'.
Now in your content (page in Site A), apply the style to the hyperlink you want to point to Site B.

Now in your masterpage add the JavaScript block displayed below:

Code:
    <script type="text/javascript">
        function addLoadEvent(func) {
            var oldonload = window.onload;
            if (typeof window.onload != 'function') {
                window.onload = func;
            }
            else
            {
                window.onload = function()
                {
                    if (oldonload)
                    {
                        oldonload();
                    }
                    func();
                }
            }
        }

        addLoadEvent(function()
        {
            try
            {
                var elements = getElementsByClassName("hyperlink_siteB");
                for (var i = 0; i < elements.length; i++)
                {
                    var hyperlink = elements[i];
                    hyperlink.href = hyperlink.href.replace("http://www.siteA.com", "http://www.siteB.com");
                }
            }
            catch (ex){ }
        });
        
        /*
            Developed by Robert Nyman, http://www.robertnyman.com
            Code/licensing: http://code.google.com/p/getelementsbyclassname/
        */
        var getElementsByClassName = function (className, tag, elm){
            if (document.getElementsByClassName) {
                getElementsByClassName = function (className, tag, elm) {
                    elm = elm || document;
                    var elements = elm.getElementsByClassName(className),
                        nodeName = (tag)? new RegExp("\\b" + tag + "\\b", "i") : null,
                        returnElements = [],
                        current;
                    for(var i=0, il=elements.length; i<il; i+=1){
                        current = elements[i];
                        if(!nodeName || nodeName.test(current.nodeName)) {
                            returnElements.push(current);
                        }
                    }
                    return returnElements;
                };
            }
            else if (document.evaluate) {
                getElementsByClassName = function (className, tag, elm) {
                    tag = tag || "*";
                    elm = elm || document;
                    var classes = className.split(" "),
                        classesToCheck = "",
                        xhtmlNamespace = "http://www.w3.org/1999/xhtml",
                        namespaceResolver = (document.documentElement.namespaceURI === xhtmlNamespace)? xhtmlNamespace : null,
                        returnElements = [],
                        elements,
                        node;
                    for(var j=0, jl=classes.length; j<jl; j+=1){
                        classesToCheck += "[contains(concat(' ', @class, ' '), ' " + classes[j] + " ')]";
                    }
                    try    {
                        elements = document.evaluate(".//" + tag + classesToCheck, elm, namespaceResolver, 0, null);
                    }
                    catch (e) {
                        elements = document.evaluate(".//" + tag + classesToCheck, elm, null, 0, null);
                    }
                    while ((node = elements.iterateNext())) {
                        returnElements.push(node);
                    }
                    return returnElements;
                };
            }
            else {
                getElementsByClassName = function (className, tag, elm) {
                    tag = tag || "*";
                    elm = elm || document;
                    var classes = className.split(" "),
                        classesToCheck = [],
                        elements = (tag === "*" && elm.all)? elm.all : elm.getElementsByTagName(tag),
                        current,
                        returnElements = [],
                        match;
                    for(var k=0, kl=classes.length; k<kl; k+=1){
                        classesToCheck.push(new RegExp("(^|\\s)" + classes[k] + "(\\s|$)"));
                    }
                    for(var l=0, ll=elements.length; l<ll; l+=1){
                        current = elements[l];
                        match = false;
                        for(var m=0, ml=classesToCheck.length; m<ml; m+=1){
                            match = classesToCheck[m].test(current.className);
                            if (!match) {
                                break;
                            }
                        }
                        if (match) {
                            returnElements.push(current);
                        }
                    }
                    return returnElements;
                };
            }
            return getElementsByClassName(className, tag, elm);
        };    
    </script>

The forum has moved

This forum is no longer in use, so you can't reply to this message - please go to Our Umbraco

Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.