How smarty reads js variables

Hello, everyone. Now I have such a problem.

in controller, there is the code $this- > photos = $results;, which is a two-dimensional array.
then in the template file html, there is code < {$photosindex} >, where index is a variable of js code.
simply writing this will report that index is not defined, so what can I do to dynamically read the established data elements?

Thank you!

Apr.09,2021
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3b89a-e7ef.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3b89a-e7ef.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?