We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 7327
    • 195 Posts
    Hey guys,

    I've gotten back to Revo recently and have been playing around with it for a project and I've encountered something that had me almost pointing at MODX due to its obscure nature. I'm using JQuery tabs 1.9.2 (latest one out) and for some odd reason, my homepage kept appearing inside the tab container! But a couple of hours of trying to isolate the problem, I found out that it's due to a change in how Jquery behaves involving the <base> tag. Simply put, I didn't see the problem when I was making my static HTML pages until I loaded them up on MODX when I needed to put in a <base> tag. Now this is an odd problem because according to the JQuery guys, this isn't a bug and the issue seems to be solved by taking out the <base> tag. But from a CMS user's stand point, I can see that not using the <base> tag is not feasible.

    In case anyone's interested in a hack, see solution by oZone http://bugs.jqueryui.com/ticket/8637 below (just put it before using the .tabs() function:

    $.fn.__tabs = $.fn.tabs;
    $.fn.tabs = function (a, b, c, d, e, f) {
    	var base = location.href.replace(/#.*$/, '');
    	$('ul>li>a[href^="#"]', this).each(function () {
    		var href = $(this).attr('href');
    		$(this).attr('href', base + href);
    	});
    	$(this).__tabs(a, b, c, d, e, f);
    };


    Does anyone have a better suggestion to work around this?

    EDIT: All right, I did another test. My tab href values were just set to "#tab-whatever", but it seems to make the tabs work with the base without any work around, hrefs need to be expressed as "[[~[[*id]]]]#tab-whatever"


    [ed. note: diatomin last edited this post 13 years, 10 months ago.]
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      That is a know issue with using named anchors.

      http://rtfm.modx.com/display/revolution20/Named+Anchor
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 7327
        • 195 Posts
        Hey Susan,

        Great to know it's documented. I've been searching for "base", "modx revo", "problem", and "homepage" for hours!
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          It's not really anything to do with MODx itself, it's just an unfortunate combination of how several different things work; the web server's rewrite rules, the base tag in a browser, and named anchors.
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org