Hello,
Following the documentation I've tried for the first time to extend an helper...
So I've created a file 'text.php' (with the same name as the helper 'text') like this :
Code:
<?php
function format_price($number){
return (substr($number, -2)==00) ? substr($number, 0, -3).'.-' : sprintf("%.2f",($number));
}
?>
I put it in app/Helpers, but when I tried to call it in a Controller :
Code:
helper('text');
$data['price'] = format_price(45);
I've got an error like this (strangely with no controller's name) :
Call to undefined function App\Controllers\ctrl_web\format_price()
I don't understand what I do wrong... I've tried to create a new helper ('text2.php') without success, too.
Thank you for your lights and I wish you a merry Christmas and a happy new year !