3
You have to understand how smarty works. Smarty is basically a shorthand writing style for dynamically assigned variables for PHP. In the PHP files, the variables are assigned to Smarty variables, to be interpreted by the rendering sequences of the code. If you add references to variables without having assigned any values to them, or to code that already has been interpreted by the rendering codes (such as you're doing in both cases), this will fail.
Basically, the order in which this needs to be done is this:
php script defines smarty variables to dynamically assign values to;
html script gets interpreted by rendering code, which puts the dynamic values to the assigned smarty variables;
display the content.
You're trying to add a nexts tep, which is actually the second one.
I hope that makes it a bit more clear for you.
Herko