database - Twig - SQL request Result isn't displayed -
i have 1 table in database couple of column 1 called "description". using silex framework, when sql request ...:
$app->get('/', function () use($app){ $sql = "select * site"; $post = $app['db']->fetchall($sql); print_r($post); homecoming $app['twig']->render('index.html.twig', array("site" => $post)); })->bind('index');
... every line , in table displayed, good.
when utilize twig results in view ... :
{% elem in site %} <h4>{{ elem.titre }}</h4> <ul> <li>type : {{ elem.type }}</li> <li>description : {{ elem.description }}</li> <li>statut : {% if elem.statut == 1 %}en ligne{% else %}hors ligne{% endif %}</li> <li>tags : {{ elem.keyword }}</li> <li><a href="{{ elem.site_url }}">lien</a></li> </ul> {% endfor %}
... every element displayed except "description" 1 nil appear. name right since have no error while loading page. don't understand element displayed printr used before not using twig in view.
database symfony2 twig silex
No comments:
Post a Comment