You are using a template tag and then using the PHP code. But the class you are referencing in the template is already destroyed. “$this” is only valid inside a class method or globally within the class. You should not rely on $this being the class pointer to the smarty template class.
If you want to do this in a template (not recommended) do:
I didn't get the answer I was looking for in this thread, but the question is exactly what I would like to know. How to enable php in version 4.0. Anyone?