ouldfella Posted August 31, 2017 Share Posted August 31, 2017 hi i did this code : $tarifs = Capsule::table('voip') ->get(); $countTotal = count($tarifs); $encodedata = json_encode($tarifs); $tarifs = json_decode($encodedata, true); var_dump($tarifs[0]["iso"]); but in tpl file when i do this : {$tarifs[0]["iso"]} nothing is shown 0 Quote Link to comment Share on other sites More sharing options...
WHMCS Developer WHMCS Andrew Posted August 31, 2017 WHMCS Developer Share Posted August 31, 2017 You would need to take a look at the Smarty documentation and how arrays are handled. Please see https://www.smarty.net/docs/en/language.variables.tpl#language.variables.assoc.arrays Essentially, {$tarifs.0.iso} 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted August 31, 2017 Share Posted August 31, 2017 not sure if this is in a hook or your using the dreaded {php} tags(!), but you haven't assigned/returned $tarifs to a Smarty array... if you did that, you should be able to access it in the template - either directly as Andrew suggests, or by using a foreach loop if you wanted to show the entire array. 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.