The FuelPHP parser for Twig makes a lot of Fuel helpers available using a Twig extension.
Check the ./classes/twig/fuel/extension.php
file in the Parser package to see which ones. Html::anchor is included too.
문제
I have the below line of code in the FuelPHP view file (php) and I am converting the project code from PHP template to TWIG template engine.
<?php echo Html::anchor('quiz/edit/'.$quiz->id, 'Edit'); ?>
How can I convert the below line of code to work with TWIG template?
I tried the below thing in the .php file:
$data['edit_url']= Html::anchor('quiz/edit/'.$quiz->id, 'Edit');
And in .twig file, I use the below line:
{{edit_url}
With this I get the HTML code as a text(without hyperlink) as the html is escaped to normal text by default.
What I was expecting is a URL hyperlink without being escaped.
Note: I tried the below code and I get NULL out of it.
$data['edit_url']= Router::get('quiz/edit/',array('id' => $quiz->id));
해결책
The FuelPHP parser for Twig makes a lot of Fuel helpers available using a Twig extension.
Check the ./classes/twig/fuel/extension.php
file in the Parser package to see which ones. Html::anchor is included too.