php - How To Pass A Twig Output String Into the urlFor() Function -
i pass id of category parameter using urlfor().
{% category in categories %} <br> <p><a href="{{urlfor('showtopic.post', {"cat_id": "{{category.id}}"})}}">{{category.category_title}}<a><br>{{category.category_description}}</p> <br> <br> {% endfor %}
this not work. passes in {{category.id}} instead of actual id category. have id each category in database. if try use {{category.category_title}}, know works because output title, same thing. help
try
<a href="{{urlfor('showtopic.post', {"cat_id": category.id})}}">{{category.category_title}}<a>
you don't need surround category.id
{{
, }}
because in print mode
Comments
Post a Comment