Dadou76620 Posted August 14, 2016 Share Posted August 14, 2016 Hello I just created a hook but this one return me an array <?php if (!defined("WHMCS")) die("This file cannot be accessed directly"); use Illuminate\Database\Capsule\Manager as Capsule; function hook_template_variables_example($vars) { $data = Capsule::table('mod_wizardpanelsettings')->get(); foreach($data as $datas) { $extra = json_decode(json_encode($datas), true); } $array = array( 'favicon' => $extra['favicon'] ); return $array; } add_hook('ClientAreaHeaderOutput', 1, 'hook_template_variables_example'); ?> when I made a print_r($array); he return me Array ( [favicon] => teste url favicon ) as well header.tpl I call my variable {$favison} Cordially 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted August 14, 2016 Share Posted August 14, 2016 because you add the whole array as favicon value, lets apply small change <?php if (!defined("WHMCS")) die("This file cannot be accessed directly"); use Illuminate\Database\Capsule\Manager as Capsule; function hook_template_variables_example($vars) { $data = Capsule::table('mod_wizardpanelsettings')->get(); foreach($data as $datas) { $extra = json_decode(json_encode($datas), true); $favicon = $extra['favicon']; } $array = array( 'favicon' => $favicon ); return $array; } add_hook('ClientAreaHeaderOutput', 1, 'hook_template_variables_example'); ?> 0 Quote Link to comment Share on other sites More sharing options...
Dadou76620 Posted August 15, 2016 Author Share Posted August 15, 2016 Thank you for your reply. I did like this it also works that correct? <?php if (!defined("WHMCS")) die("This file cannot be accessed directly"); use Illuminate\Database\Capsule\Manager as Capsule; function hook_template_variables_example($vars) { global $smarty; $data = Capsule::table('mod_wizardpanelsettings')->get(); foreach($data as $datas) { $extra = json_decode(json_encode($datas), true); } $array = array( 'favicon' => $extra['favicon'] ); $smarty->assign('wizardpanel', $array); } add_hook('ClientAreaHeaderOutput', 1, 'hook_template_variables_example'); ?> I have one last question In the function 'function demo_output($vars)' how can retrieve the variable '{$WEB_ROOT}' ? Cordially 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted August 15, 2016 Share Posted August 15, 2016 function demo_output($vars){ $WEB_ROOT = $vars['WEB_ROOT']; } 0 Quote Link to comment Share on other sites More sharing options...
Dadou76620 Posted August 15, 2016 Author Share Posted August 15, 2016 I really like you but $WEB_ROOT displays nothing <?php function demo_output($vars) { $modulelink = $vars['modulelink']; $version = $vars['version']; $WEB_ROOT = $vars['WEB_ROOT']; $LANG = $vars['_lang']; } ?> 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted August 15, 2016 Share Posted August 15, 2016 I really like you but $WEB_ROOT displays nothing <?php function demo_output($vars) { $modulelink = $vars['modulelink']; $version = $vars['version']; $WEB_ROOT = $vars['WEB_ROOT']; $LANG = $vars['_lang']; } ?> what ActionHook point you are using with the "demo_output" function? variables available are different based on what ActionHook point is called 0 Quote Link to comment Share on other sites More sharing options...
Dadou76620 Posted August 15, 2016 Author Share Posted August 15, 2016 Sorry if I do not understand I'm french you ask me: add_hook( "AdminHomeWidgets", 1, "widget_wizardpanel_addon" ); 0 Quote Link to comment Share on other sites More sharing options...
Dadou76620 Posted August 20, 2016 Author Share Posted August 20, 2016 Hello I have wanted to know how to recover the root or a whmcs eter settle in function demo_output($vars) { $modulelink = $vars['modulelink']; $version = $vars['version']; $LANG = $vars['_lang']; $webroot = $vars['WEB_ROOT']; my hook.php add_hook('ClientAreaHeaderOutput', 1, demo_output); Sorry if I do not fully understand the operation I am french Cordially 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.