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

Popular posts from this blog

javascript - oscilloscope of speaker input stops rendering after a few seconds -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -