Page 1 of 1

Including PHP

Posted: Tue Aug 25, 2009 1:20 am
by Joe McPlumber
Hi,

I have a PHP script for querying Amazon and displaying the results. It works fine on its own.

If i put it into a UDT it's unhappy until i move all the functions to the beginning of the script. Once i do that it mostly works except i get an error like this:

Code: Select all

Warning: Invalid argument supplied for foreach() in /home/test/public_html/lib/content.functions.php(771) : eval()'d code on line 166
If i leave the script alone and place it between {php} tags, i get an error like this:

Code: Select all

Warning: Invalid argument supplied for foreach() in /home/test/public_html/tmp/templates_c/%%06^065^065BC93F%%tpl_body%3A27.php on line 517
But it's not an invalid argument since it works outside of CMSMS.

I'd be happy to solve this, but mostly i'd like to get a general handle on what i should or should not try to do with PHP inside of CMSMS, and what sort of guidelines i should follow. I put a lot of work into modifying this script, assuming that when i was done i'd just make a UDT and be done with it. Is that not a generally safe assumption?

Thanks,
-joe

Re: Including PHP

Posted: Tue Aug 25, 2009 4:24 am
by RonnyK
you can put the logic in a UDT, but have to remember to NOT use the opening/ending

Ronny