Welcome, Guest
Username Password: Remember me

Hide plugin on content pages
(1 viewing) (1) Guest
  • Page:
  • 1
  • 2

TOPIC: Hide plugin on content pages

Hide plugin on content pages 14 years ago #609

  • gavner
  • OFFLINE
  • Fresh Boarder
  • Posts: 12
  • Karma: 0
Hi, if you have a look at my mobile site forthelove.pnworldwide.net on iphone only, select any article and you will see a social media plugin to the left which is chopped off. I would like to basically hide this when the page opens as it makes the page flicker. What code would i insert to do this?

Hide plugin on content pages 14 years ago #2526

  • gavner
  • OFFLINE
  • Fresh Boarder
  • Posts: 12
  • Karma: 0
i really need some help on this..please..the plugin is called plg_scrollingsharebutton

Hide plugin on content pages 14 years ago #2527

  • Barnabas
  • OFFLINE
  • Moderator
  • Posts: 329
  • Karma: 6
Have a look at
www.mobilejoomla.com/forum/topic.html?id=518
www.mobilejoomla.com/forum/topic.html?id=378
and see if the instructions for amending the plugin disqus could be used on plg_scrollingsharebutton.
Essentially the instructions are for a dynamic disable of the plugin. It will only turn off the plugin while being viewed by the mobile. The next visitor from a desktop browser sees the plugin.

If you can find the code in the plugin that checks if it is enabled, then you need to add the code suggested by dryabov into the plugin after it.

Hide plugin on content pages 14 years ago #2530

  • Barnabas
  • OFFLINE
  • Moderator
  • Posts: 329
  • Karma: 6
I have installed plg_scrollingsharebutton 1.8 on my test site and tested how to turn it off for mobile.
The instructions above did not work because the plugin defines some functions which persist. You need to edit the function as follows.
Edit scrollingsharebutton.php
    		$VFBlikePosition=$this->_params->get('FBlikePosition');
$VFBlikeTB=$this->_params->get('FBlikeTB');
$showinArticle=$this->_params->get('showinArticle');
if(defined('_MJ')) $showinArticle=false;

ie add the last line after the point where the Show in Article parameter is set. You are dynamically turning it off for a mobile.

Hide plugin on content pages 14 years ago #2532

  • dryabov
  • OFFLINE
  • Administrator
  • Denis Ryabov, Lead Developer
  • Posts: 4867
  • Karma: 105
Try to add
<?php if(defined('_MJ')) return; ?>

at the beginning of plugin's file(s).

Hide plugin on content pages 14 years ago #2533

  • Barnabas
  • OFFLINE
  • Moderator
  • Posts: 329
  • Karma: 6
I put the code you suggested
<?php if(defined('_MJ')) return; ?>
<?php
/*
// Scrolling Share Button Plugin for Joomla! 1.5.x - Version 1.8

but it did not turn off the plugin for mobile.

Hide plugin on content pages 14 years ago #2534

  • dryabov
  • OFFLINE
  • Administrator
  • Denis Ryabov, Lead Developer
  • Posts: 4867
  • Karma: 105
Barnabas wrote:
I put the code you suggested
but it did not turn off the plugin for mobile.


OK. It means that this plugin is triggered on OnAfterStart event (and _MJ constant is defined in OnAfterRoute). Try the following code:
 
if(class_exists('MobileJoomla') && is_object(MobileJoomla::getInstance())) return;
 

Hide plugin on content pages 14 years ago #2536

  • Barnabas
  • OFFLINE
  • Moderator
  • Posts: 329
  • Karma: 6
I tried that too and it did not work.

Hide plugin on content pages 14 years ago #2537

  • dryabov
  • OFFLINE
  • Administrator
  • Denis Ryabov, Lead Developer
  • Posts: 4867
  • Karma: 105
Barnabas wrote:
I tried that too and it did not work.

1. Check that MJ is the first plugin of system group (that is there is no way for other plugins to be runned before MJ).
2. Clear cache to check that it's not a cache issue.

Hide plugin on content pages 14 years ago #2540

  • Barnabas
  • OFFLINE
  • Moderator
  • Posts: 329
  • Karma: 6
It did not work. I cleared cache. So I tried to get proof that the mobilebot.php was the first to run, but I was not able to get it to echo or print a message. The error message I got was

The page you are trying to view cannot be shown because it uses an invalid or unsupported form of compression.
Maybe it was the first and there was no supporting environment/html to display the message.
I had previously put an echo into the scrolling share button php which did print.
  • Page:
  • 1
  • 2
Time to create page: 0.24 seconds

By continuing to use this site you consent to the use of cookies on your device as described in our cookie policy unless you have disabled them. This site will not function correctly without cookies.

I accept cookies from this site.