0
我得到一個錯誤的修身說錯誤與超薄+嫩枝urlFor()
Message: An exception has been thrown during the rendering of a template
("Named route not found for name: userList") in "sidebar.twig" at line 7.
我的看法是
{% extends 'base.twig' %}
{% block title %} Índice {% endblock title %}
{% block content %}
<div class="row">
<div class="container">
{% include "sidebar.twig" %}
我的看法是sidebar.twig如下:
<div class="col-lg-4 col-md-4 col-xs-4">
<div class="dropdown menu col-lg-9 col-md-9 col-xs-9">
<ul class="nav nav-pills nav-stacked">
<li><a tabindex="-1" href="#">GESTIÓN DE PARTICIPANTES</a></li>
{% if authorized %}
<li><a tabindex="-1" href="{{ urlFor('userList') }}">GESTION DE USUARIOS</a></li>
{% endif %}
</ul>
</div>
</div>
code for view + model
在github上$app->get('/users', function() use ($app, $authorized,$users)
{
$app->render('users.twig',array('users' => $users, 'is_admin' => $authorized));
})->name('userList');
代碼是=>https://github.com/Mangulomx/olimpiada
檢查您的路線文件是否定義了路線名'userList'?顯示代碼從路線文件 –
我顯示$ app-> get('/ users',function()use($ app,$ authorized,$ users) { $ app-> render('users.html.twig ',array('users'=> $ users,'is_admin'=> $ authorized)); }) - > name('userList'); – mangulom
請檢查http://help.slimframework.com/discussions/problems/943-cant-get-twig-extensions-to-work此回覆發佈者Brian Nesbitt於2012年9月29日@ 08:44 AM –