Plugin does not work in one artile but works everywhere else Topic is solved

This forum is for general questions about extensions for Joomla! 3.x.

Moderators: pe7er, General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Post Reply
anildagia
Joomla! Apprentice
Joomla! Apprentice
Posts: 15
Joined: Sat Jun 28, 2014 5:11 pm

Plugin does not work in one artile but works everywhere else

Post by anildagia » Fri Aug 03, 2018 8:40 am

Hi,


I have a 3rd party plugin installed on my joomla website (3.8.11 / PHP7.2 / MySQL 5.6)

I have one menu item for "Single Article". When I put the plug in in that article - it works.

In fact if I put that plugin in any article - it works - except - one specific article.

I can't figure out why this is happening and how to fix.

Please help

User avatar
sozzled
Joomla! Champion
Joomla! Champion
Posts: 5832
Joined: Sun Jul 05, 2009 3:30 am
Location: Canberra, Australia
Contact:

Re: Plugin does not work in one artile but works everywhere else

Post by sozzled » Fri Aug 03, 2018 8:43 am

Needle. Haystack. Where's the haystack?

What is the name of the "third-party extension"? Have you enabled Jooma debug mode and set error reporting to maximum? Do you see any errors written to the file error_log in the root folder of your website?
https://www.kuneze.com/blog
Former member of Kunena project team
If you think I’m wrong then say “I think you're wrong.” If you say “You’re wrong!”, how do you know?

anildagia
Joomla! Apprentice
Joomla! Apprentice
Posts: 15
Joined: Sat Jun 28, 2014 5:11 pm

Re: Plugin does not work in one artile but works everywhere else

Post by anildagia » Fri Aug 03, 2018 6:47 pm

Cool. Thanks for the inputs to debug. Let me proceed with these checks and I will revert with more information.

P.S.: The plugin is powr countdown timer. The one article in which it does not work - it shows the plugin text that I add to the article and does not process the plug-in code. Meaning if the plugin text to be added is {powr abcde} - it displays it rather than processing the code.

Anyways, Let me do these checks and revert

anildagia
Joomla! Apprentice
Joomla! Apprentice
Posts: 15
Joined: Sat Jun 28, 2014 5:11 pm

Re: Plugin does not work in one artile but works everywhere else

Post by anildagia » Fri Aug 03, 2018 6:49 pm

Just a quick question

Is there any configuration in the article or in the menu which tells joomla whether to process the plugin code and prepare the content or not?

User avatar
AMurray
Joomla! Virtuoso
Joomla! Virtuoso
Posts: 3951
Joined: Sat Feb 13, 2010 7:35 am
Location: Australia

Re: Plugin does not work in one artile but works everywhere else

Post by AMurray » Sat Aug 04, 2018 2:44 am

Does the module work; you can use {loadposition XX} to put the module in an article, or use something like Modules Anywhere.
Regards,
--------------------------------------------------------------
A Murray
Millennium Falcon - it's the ship that made the Kessel run in less than 12 parsecs! The fastest hunk of junk in the galaxy.

anildagia
Joomla! Apprentice
Joomla! Apprentice
Posts: 15
Joined: Sat Jun 28, 2014 5:11 pm

Re: Plugin does not work in one artile but works everywhere else

Post by anildagia » Sat Aug 04, 2018 10:54 am

AMurray wrote:
Sat Aug 04, 2018 2:44 am
Does the module work; you can use {loadposition XX} to put the module in an article, or use something like Modules Anywhere.
Yes. In that same article there is a module loaded and that module is loading, content gets prepared and displayed properly.

Meanwhile I have done the debug steps as suggested by " sozzled "

I have attached the output of the debug.

I did not find anything in the PHP error log. Nothing pertaining to this page or this plugin. Nor did I find anything in Apache error logs.

Funny thing is that the debug output related to this plugin that is shown for this one page where it does not work - is the same as the debug output related to this plugin for the page where it does work properly.
You do not have the required permissions to view the files attached to this post.

anildagia
Joomla! Apprentice
Joomla! Apprentice
Posts: 15
Joined: Sat Jun 28, 2014 5:11 pm

Re: Plugin does not work in one artile but works everywhere else

Post by anildagia » Sat Aug 04, 2018 11:16 am

OK,

I have figured out where it is coming to in the code - but now I do not know how to proceed.

The place upto where the code works exactly the same in the pages where it works as well as the page where it does not work is as given below:

Code: Select all

			js = "(function(d){
					  var js, id = 'powr-js', ref = d.getElementsByTagName('script')[0];
					  if (d.getElementById(id)) {return;}
					  js = d.createElement('script'); js.id = id; js.async = true;
					  js.src = '$js_url';
					  js.setAttribute('powr-token','$this->powr_token');
					  js.setAttribute('external-type','joomla');
					  ref.parentNode.insertBefore(js, ref);
					}(document));";				
			$document = JFactory::getDocument();  
			$document->addScriptDeclaration($js); //Add js to doc
			$POWR_JS_ADDED=true;
Before it reaches this piece of code - the code works exactly the same for all working pages and one not working page.

After this code is executed the html page is rendered.

I looked at the page source of the HTML page for the page where the plugin works as well as the source for the HTML page where the plugin does not work

I found that both pages contain the exact same js code in them.

The JS script code inserted is as follows:

Code: Select all


<script type="text/javascript">(function(d){var js,id='powr-js',ref=d.getElementsByTagName('script')[0];if(d.getElementById(id)){return;}
js=d.createElement('script');js.id=id;js.async=true;js.src='http://<mywebsitename.com>/plugins/content/powrshortcodes/powr_joomla.js';js.setAttribute('powr-token','m6CI94XyQN1525781489');js.setAttribute('external-type','joomla');ref.parentNode.insertBefore(js,ref);}

I don't know what this JS code does and how to debug this further.
Last edited by Per Yngve Berg on Mon Aug 06, 2018 4:47 pm, edited 1 time in total.
Reason: Corrected bb code tags

User avatar
toivo
Joomla! Exemplar
Joomla! Exemplar
Posts: 9946
Joined: Thu Feb 15, 2007 5:48 am
Location: Oxford, UK
Contact:

Re: Plugin does not work in one artile but works everywhere else

Post by toivo » Sat Aug 04, 2018 12:05 pm

Go to the JavaScript console in the browser and check, if errors are reported from the other page, which would explain why the code does not work.
Toivo Talikka, Global Moderator
my first programs were assembled and run in 16KB :)
troubleshooting smtp and other articles https://talikka.com/joomla

anildagia
Joomla! Apprentice
Joomla! Apprentice
Posts: 15
Joined: Sat Jun 28, 2014 5:11 pm

Re: Plugin does not work in one artile but works everywhere else

Post by anildagia » Mon Aug 06, 2018 12:51 pm

toivo wrote:
Sat Aug 04, 2018 12:05 pm
Go to the JavaScript console in the browser and check, if errors are reported from the other page, which would explain why the code does not work.
Thanks. I got the breakthrough.

The other module which was being loaded in this page was displaying text with an apostrophe.. And for some reason the JS of this plugin was getting messed up. Removed the apostrophe - and it started working like a charm.

It would be nie to figure out why the apostrophe of one module is messing up the code of another plugin - But that I guess is for another day, another time.

For now I am good to go.

Thanks for all the inputs.


Post Reply

Return to “Extensions for Joomla! 3.x”