Using UDT to include() an external php file in content page

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.
Locked
heatherfeuer

Using UDT to include() an external php file in content page

Post by heatherfeuer »

Okay... I've tried every combination imaginable, searched and researched the forum, found some possible solutions, guidelines, none of them worked, so....

I have large php script that I want to include in a content page.  It has more than one function so I can't just copy/paste into a UDT.  So, after reading up, I uploaded the php file to the uploads directory.  Then I created a UDT tag called "formmailer" with the following function call:

Code: Select all

include(uploads/formmailer.php);
I create the content page and there I simply put {formmailer}.  When I try to open that page, I get this is the content area:

Code: Select all

Warning: Division by zero in /home/faith/public_html/lib/content.functions.php(669) : eval()'d code on line 1

Warning: cms_tmp_formmailer_userplugin_function(php): failed to open stream: No such file or directory in /home/faith/public_html/lib/content.functions.php(669) : eval()'d code on line 1

Warning: cms_tmp_formmailer_userplugin_function(php): failed to open stream: No such file or directory in /home/faith/public_html/lib/content.functions.php(669) : eval()'d code on line 1

Warning: cms_tmp_formmailer_userplugin_function(): Failed opening 'php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/faith/public_html/lib/content.functions.php(669) : eval()'d code on line 1
I've tried several path differences and it all comes out the same.  I'm stumped!  Help!  What am I doing wrong?
heatherfeuer

Re: Using UDT to include() an external php file in content page

Post by heatherfeuer »

Okay, just for fun and my edification, I uploaded the standard "hello.php" file with the function phpinfo() in it.  First I put it in the uploads directory and created a UDT named "test."  In the content page, I put {test}.  Got the same division by 1 error.  Uploaded the file to the root directory.  Edited the UDT to {hello.php}.  Tried opening the page again.  This time I got the following error:

Code: Select all

Warning: cms_tmp_test_userplugin_function(hellophp): failed to open stream: No such file or directory in /home/faith/public_html/lib/content.functions.php(669) : eval()'d code on line 1

Warning: cms_tmp_test_userplugin_function(hellophp): failed to open stream: No such file or directory in /home/faith/public_html/lib/content.functions.php(669) : eval()'d code on line 1

Warning: cms_tmp_test_userplugin_function(): Failed opening 'hellophp' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/faith/public_html/lib/content.functions.php(669) : eval()'d code on line 1
It's got to be that I'm forgetting something, but I have no clue what...
User avatar
chead
Forum Members
Forum Members
Posts: 63
Joined: Tue Feb 06, 2007 4:01 am

Re: Using UDT to include() an external php file in content page

Post by chead »

I think it's syntax in your UDT. Try:

include 'uploads/formmailer.php';
heatherfeuer

Re: Using UDT to include() an external php file in content page

Post by heatherfeuer »

Thanks!  That's all I needed to do.  Now I'm really impressed with CMSms because this facility opens up so many options....  ;D
Locked

Return to “CMSMS Core”