Including PHP

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
Joe McPlumber
Forum Members
Forum Members
Posts: 14
Joined: Tue May 19, 2009 8:03 pm

Including PHP

Post 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
RonnyK
Support Guru
Support Guru
Posts: 4962
Joined: Wed Oct 25, 2006 8:29 pm

Re: Including PHP

Post by RonnyK »

you can put the logic in a UDT, but have to remember to NOT use the opening/ending

Ronny
Post Reply

Return to “CMSMS Core”