Announcement

Collapse
No announcement yet.

Regarding .tpl file in plugin

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Regarding .tpl file in plugin

    Hi,
    How can I perform API call (written in php) inside .tpl file ? I have following php code inside .tpl file & If I'm trying to run below code its showing this error 'A system error has occurred. Please try your request again in a few minutes. '.
    Its because of SoapClient call. I don't know the proper way to use SoapClient inside the .tpl file, so please suggest me one good example.

    {php}
    class Test
    {
    public function authenticate($api_controller, $action, $input=null)
    {
    $key = array( ’email’ => ’siteworx@siteworx.com’,
    ’password’ => ’siteworxpass’,
    ’domain’ => ’example.com’ );
    $client = new SoapClient( 'https://%%SERVERNAME%%:2443/soap?wsdl' );
    if (!$input) {
    $response = $client->route($key, $api_controller, $action);
    }
    else {
    $response = $client->route($key, $api_controller, $action, $input);
    }
    return $response;
    }


    public function getSize()
    {
    $action = 'listAccountDetails';
    $api_controller = '/siteworx/overview';
    $response = $this->authenticate($api_controller, $action);
    return $response['payload']['remaining_diskspace'];
    <!-- It will return disk size ex 500MB -->
    }
    }
    $control_panel = new Test();
    print_r($control_panel->getSize());
    {/php}




    Thank you,
    kiran

  • #2
    Hi kiran

    You may want to hold off until the smarty has been corrected fully.

    If you have updated to IW smarty 3.1, there is something giving an error but all appears to work

    Also, smarty 3.1 has depreciated some php code

    Many thanks

    John

    Comment

    Working...
    X