• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
Custom Tabs

Custom Tabs 1.6.3

No permission to download

Siropu

Well-known member
It looks like the class is not used on mobile. Try this instead:

CSS:
@media (max-width:@maxResponsiveNarrowWidth)
{
     a.navLink[href="javascript:void(0)"]
     {
          display: none;
     }
}
 
I luv this addon I was using on my previous XF version but I just upgraded my site to XF version 2, I wonder if this plugin still works for XF version 2 or you will update this addon, this is one of my favorite plugins in here.
 

Ludachris

Well-known member
I just had a custom add-on created that is an extension of the Showcase add-on. It's essentially just a couple of pages that list the items from showcase in a different way. I want to give these new page their own navigation tab and breadcrumb. Currently, it uses the same route as Showcase, as the Showcase tab is selected when viewing it.

On my dev server I created a tab using Custom Tabs, along with a child tab for the second page. I entered the URL of the page in the Link field. The result is the new tab is selected as well as the Showcase tab. I dug into the add-on code and found the line where it sets Showcase as the route (in the public controller). I commented that line out. The Showcase tab no longer shows as selected, and the Custom Tab stays selected. But the child tab doesn't display.

More info: I found that a Route Prefix exists and the name is the same as the URL of the page. I'm wondering if that is causing issues.

What do I need to do to make this work?
 

Siropu

Well-known member
You can control breadcrumbs via template so the page you link to can have something like:
Code:
<xen:navigation>
    <xen:breadcrumb href="{xen:link full:route}">breadcrumb name</xen:breadcrumb>
</xen:navigation>
 

Ludachris

Well-known member
@Ludachris, try this code in EXTRA.css to see if fixes the child issue:
CSS:
.siropuCustomTab.selected .tabLinks {
    z-index: 1;
}
Another question on routes... I have a filter system that adds to the end of the URL for these pages. When you select a filter option, the custom tab is no longer selected. Can I address this in the custom tabs interface or is this a coding issue for the add-on? I can PM you a link to see what I'm talking about. Thanks in advance!
 

Ludachris

Well-known member
Might I suggest a edit to Helper.php

this code will support selecting the Tab in case the url is something like "/custom-tab/page.2/something.4/View"

PHP:
public static function uriMatch($uri)
    {
        $requestPaths  = XenForo_Application::get('requestPaths');
        $requestUri    = $requestPaths['requestUri'];
        $requestAddon  = "/".substr(substr($requestPaths['requestUri'],1),0,strpos(substr($requestPaths['requestUri'],1),'/'))."/";
        $fullUri       = $requestPaths['fullUri'];
        $noBasePathUri = substr($requestUri, strlen($requestPaths['basePath']), strlen($requestUri));
        if ($uri == $requestUri || $uri == $requestAddon || $uri == $fullUri || $uri == $noBasePathUri)
        {
            return true;
        }
    }
Hey @DDempsey - I tried using this code but could not get it to work. The tab selection works except when there is something added to the end of the URL. For example this works "/custom-tab/" but this does not "/custom-tab/filter?type=22". How can your code above be edited to address my situation?
 

Siropu

Well-known member
@Ludachris, try this code (replace the uriMatch method):
PHP:
public static function uriMatch($uri)
    {
        $requestPaths  = XenForo_Application::get('requestPaths');
        $requestUri    = $requestPaths['requestUri'];
        $fullUri       = $requestPaths['fullUri'];
        $noBasePathUri = substr($requestUri, strlen($requestPaths['basePath']), strlen($requestUri));

        if ($uri == $requestUri
            || $uri == $fullUri
            || $uri == $noBasePathUri
            || preg_match('/[?&]/', $noBasePathUri) && preg_match('@^/?' . preg_quote($uri) . '@', $noBasePathUri))

        {
            return true;

        }
    }
This will work with routes, not full URLs.