Explicitly create output variable

Add an explicit assignment of the output variable to clarify where
it starts being used. This also avoids warnings from PHP which
Smarty was presumably swallowing previously.

Patch set 2: don't reset the variable each iteration

Change-Id: I38d63df5afed55079725d1cdfb57751b96ce68f4