Page 1 of 1

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

Posted: Fri Mar 09, 2007 6:41 pm
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?

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

Posted: Fri Mar 09, 2007 6:50 pm
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...

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

Posted: Fri Mar 09, 2007 8:36 pm
by chead
I think it's syntax in your UDT. Try:

include 'uploads/formmailer.php';

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

Posted: Fri Mar 09, 2007 8:38 pm
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