1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Created new plugin but do not need it on mobile style

Discussion in 'XenForo Development Discussions' started by mmoore5553, Apr 21, 2012.

  1. mmoore5553

    mmoore5553 Well-Known Member

    Okay I created some tabs that are on the side on the forum and works great but it shows on mobile skin which i do not want.

    Anyone know any condition statements i can put not to show it ?

    I been searching and unable to find anything.

    Right now i have module called in 2 hooks - header and body .

    So i know why it is showing up in both skins but unable to figure out how to just specifiy a specific style.
     
  2. mmoore5553

    mmoore5553 Well-Known Member

    Okay this is the php file. I have tried to use an IF then and it still does not work. I believe because it is not accepting {$style.title}. I think i can redo the module where you have to put a hook in the template but rather not . Any ideas ?

    PHP:
    class socialaddon_Listener_social
    {
        public static function 
    templateHook($hookName, &$contents, array $hookParamsXenForo_Template_Abstract $template)
        {
       
       
            if(
    $hookName == 'body')
            {
           
           
           
                
    ob_start();
                require_once(
    'slider.php');
                
    $contents .= ob_get_contents();
                
    ob_end_clean();
               
               
            }
            
     
  3. ragtek

    ragtek Guest

    this condition should work

    $visitor = XenForo_Visitor::getInstance();
    if ($visitor['style_id'] != MOB_STYLE_ID) {

    }

    then the code inside of the if condition won't be run in the mobile style:)
     
  4. mmoore5553

    mmoore5553 Well-Known Member

    thanks ragtek but where would i put that and wouldn't the style ID be different for everyone install ?
     
  5. CyclingTribe

    CyclingTribe Well-Known Member

    No - the style ID is an internal XF reference to the style so everyone using that style will have the same number - just hover over the mobile style link in your ACP and you'll see the style ID in the URL.

    Then update ragtek's conditional to include the number of your mobile style and put your tabs code inside the curly brackets. (y)

    Cheers,
    Shaun :D
     

Share This Page