PDA

View Full Version : Smarty Question - How to pass variables back to PHP?


ambition13
06-23-2006, 08:51 PM
This may be the wrong way to go about doing this, but I am trying to add some php code to main.tpl.

So what I am doing is using the {php} smarty tag and then inputting my php code then closing with {/php}. However, when I do this I am unable to access the smarty variables, such as {assign var="description" value=$category.DESCRIPTION} using either $description or anything else I can think of in the php code itself.

Is there a way to access these variables from straight php or I am going about this the wrong way completely?

Thanks a lot for your help.

David
06-24-2006, 12:15 AM
The variable needs to be assigned in the PHP code in the first place, not in Smarty.

ambition13
06-24-2006, 06:22 PM
Hey thanks for the reply David. I was able to realize I was going about this the wrong way and I did figure out how to do the logic in the php file and just the output in the template. Thanks again.