0

Please I will be glad if anyone can help me on how to execute a php script after saving a form data from Joomla 3x Banner component.

What I want to achieve is to run a push notification after saving ads in Joomla banner component. The push works well when i run it off Joomla platform, but i dont now where to place the code so that it can execute upon saving the form.

I will be glad if anyone cal help me, thank you.

1

You can build a Joomla plugin and use the event onContentAfterSave and check if the context is com_banners.banner

This tutorial is to help you with building your plugin. When you get to the PHP part, you will write the following code:

<?php
 // no direct access
 defined( '_JEXEC' ) or die( 'Restricted access' );

 // The class name should start with plgContent
 class plgContentYourPluginName extends JPlugin {
   function onContentAfterSave($context, $article, $isNew)
   {
     if ($context == 'com_banners.banner')
     {
       //add your PHP script here
     }
     return true;
   }
 }
0

I'm not sure exactly what your trying to do but, just a suggestion, I would look at trying to leverage perhaps the event system in Joomla. Have a look at maybe creating a plugin that responds to saving the form data. Joomla has various events that can be leveraged and can let you extend functionality of the core system. Kind of like hooks where you can place your necessary function and it will run after or before a various event. See perhaps using the onContentAfterSave event. Have a look at the plugin events https://docs.joomla.org/Plugin/Events for others. Hope this helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.