Published on 05/16/2021
Published by amit
Calling a service module in PHP code
Here is a quick sample to show you how to call an awesome service in PHP file.
Option 1
1 2 3 4 |
$temp['action'] = 'get-listing-title'; $temp['key_skills'] = $_REQUEST['key_skills']; $temp['location'] = $_REQUEST['location']; echo \aw2\service\run(['service'=>'core',"module"=>'change-seo-data'],null,$temp); |
In the above example, we’re showing how to call a service and pass it variables
Option 2
1 2 3 4 5 6 |
$handlers = &aw2_library::get_array_ref('handlers'); aw2_library::set('product_tabs', $product_tabs); if(isset($handlers['woocommerce'])){ $atts['service']="woocommerce.tabs"; echo \aw2\service\run($atts); } |
In the above code, we are checking if a service exists, and then calling the service. The data is set in the global environment variable.