This is what I have right now: fuel/app/modules/dashboard/classes/twig/extension/functions/router.php:
use Fuel\Core\Router as FuelRouter; /** * Resolve named routes from inside twig templates * * @uses \Fuel\Core\Router */ class FuelRouterTwigExtension extends Twig_Extension {
public function getName() { return 'fuel_router'; }
public function getFunctions() { return array( 'fuel_router' => new Twig_Function_Function(function($router_name, $params = array()) { return FuelRouter::get($router_name, $params); }), ); } }
Now I add in bootstrap.php: Autoloader::add_classes(array( 'FuelRouterTwigExtension' => APPPATH . 'modules/dashboard/classes/twig/extension/functions/router.php', ));
I've added some features and now I can to access not only router resources but others meaningful stuff. However, I need get way in order to access fuelphp resources by automatic way (maybe a bit Reflection), my code is a bit "hardy coded"...anyway... For while what I have works very well!