Dadou76620 Posted October 12, 2016 Share Posted October 12, 2016 Hello I create a hook and my function shows me his results 1 My hooks.php use Illuminate\Database\Capsule\Manager as Capsule; $pdo = Capsule::connection()->getPdo(); $pdo->beginTransaction(); function simple_news_hook_clientarea($vars) { global $smarty; $statement = $pdo->prepare("SELECT * FROM mod_simple_news ORDER BY idnews DESC"); $statement->execute(); $pdo->commit(); $list_news = array(); $i = 0; while($data = $statement->fetch()){ $list_news[$i]['idnews'] = $data['idnews']; $list_news[$i]['titre'] = $data['titre']; $list_news[$i]['news'] = $data['news']; $list_news[$i]['date'] = $data['date']; $list_news[$i]['auteur'] = $data['auteur']; $i++; } $smarty->assign('list_news', $list_news); } add_hook('ClientAreaHeaderOutput', 1, 'simple_news_hook_clientarea'); My file TPL {$list_news|print_r} $list_news displays '1' I have an error in my function? Thank you for your help 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.