Loading a plugin on a component page

44 views
Skip to first unread message

Wilbert Schaapman

unread,
Aug 28, 2017, 5:19:11 AM8/28/17
to Joomla! General Development
I am using a component (easy-profile) where i need to load a special plugin for. this plugin converts a soundcloud url to a player.
But how can I trigger this plugin needs to scan the text of the component also?

Please help me.

Johan Janssens

unread,
Aug 28, 2017, 7:46:53 PM8/28/17
to Joomla! General Development
Hello Wilbert,

First of ask the developer of the component if his component includes support for content plugins? If it does it will work, you don't really need to limit the plugin to only trigger for your component, unless there are other places on your site you don't want the soundcloud url's to be converted?

Hope that helps?

Johan

Wilbert Schaapman

unread,
Aug 30, 2017, 7:30:55 AM8/30/17
to Joomla! General Development
The component doesnot support the content plugins.

would it be an idea to make it an system plugin, or do I have t change the code a lot..

Op maandag 28 augustus 2017 11:19:11 UTC+2 schreef Wilbert Schaapman:

Johan Janssens

unread,
Aug 30, 2017, 7:49:01 AM8/30/17
to Joomla! General Development
If the component has no support for content plugin it will not be possible to do what you are trying to do. Doing this as a system plugin will be very hard, and not the most optimised way. You would need to regex the content of the output buffer finding all soundcloud links and changing them. It's possible just not the proper way to do it.

The best solution is if the developer of the component would adds support for content plugin and content plugin events first. This is really not that hard, it just a few links of code to add the event triggers. Might be a change you can contribute to him.

You can find more info about the content events at https://docs.joomla.org/Plugin/Events/Content, especially the onContentPrepare event is what is required for your plugin to be able to filter the content and replace the soundcloud url's.

Hope that helps.

Sergio Manzi

unread,
Aug 30, 2017, 8:23:01 AM8/30/17
to joomla-de...@googlegroups.com

In similar situations I normally use the ReReplacer extension (https://www.regularlabs.com/extensions/rereplacer) by Peter van Westen.

With it you can essentially do what Johan suggested (regex the content of the output), but with a gazzilion of useful options. I never found it to be particularly "heavy", with very good page preparation times. I suggest you to try the free version and if it fits your needs eventually upgrade to the paid-for version (compare the features in the above linked page)

Cheers,

Sergio
Reply all
Reply to author
Forward
0 new messages