Hello all, I wonder if you could help me.
I am trying to add some PHP to my template using a UDT but when I submit I just see a blank white page. The blank page loaded is editusertag.php
There is quite a lot of PHP code but through trial and error I have managed to narrow down the problem to these 2 lines (edited slightly for privacy reasons):
require 'path-to-file.php';
use class\CLASS;
There is no error shown on screen or in browser dev tools, any ideas would be greatly appreciated.
a problem with adding PHP to template with UDT Topic is solved
-
- New Member
- Posts: 0
- Joined: Thu May 29, 2025 9:12 pm
Re: a problem with adding PHP to template with UDT
There is a bug in the current version where it processes the submitted code instead of just verifying it, so any PHP errors in your code or anything not parsable in admin will cause it to white screen on submit.
Best option for now is to use a plugin instead of a UDT - then you should only get errors on the page you call it on. See /lib/plugins/ for examples, and put yours in /assets/plugins.
Best option for now is to use a plugin instead of a UDT - then you should only get errors on the page you call it on. See /lib/plugins/ for examples, and put yours in /assets/plugins.
Not getting the answer you need? CMSMS support options
Re: a problem with adding PHP to template with UDT
My work around to handle the bug in UDT, is to create the UDT with only a PHP comment and then submit the full PHP code in the cms_userplugins table in phpMyAdmin.
Just remember to Clear Cache in System Maintenance after submitting the PHP code, so the UDT loads the code.
Just remember to Clear Cache in System Maintenance after submitting the PHP code, so the UDT loads the code.
Re: a problem with adding PHP to template with UDT
just for reference: https://dev.cmsmadesimple.org/bug/view/12749
This bug has already been fixed in the trunk, hasn't it?
file \admin\editusertag.php line 98
instead of
it's now:
This bug has already been fixed in the trunk, hasn't it?
file \admin\editusertag.php line 98
instead of
Code: Select all
try
{
eval($code);
ob_get_clean();
};
Code: Select all
try
{
# let's try to eval the code but not execute it
$tmp = 'return;' . $code;
eval($tmp);
ob_get_clean();
}