php - TWIG Random Command - On Reload -


i'm quite new php/twig, have been trying use twig 'random' command, example following:

{{ random(['apple', 'orange', 'citrus']) }} {# example output: orange #}

it works first time when save file, i'd work every time reload page; seems create new random option when re-save file.

this function works right, if number of options small (like 3 options of official example) it's common see 1 value again , again. try add more values , you'll see different value each time.

another issue might happening page cached , therefore, see first selected result until reload page. twig cache doesn't affect random() function, http cache or other php cache may affect it.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -