View Full Version : PHP scripts in a notice
Cyburbia
08-16-2012, 04:08 AM
A simple question: is there any way to include PHP scripts using the standard method of code inside <?php ?> tags inside a notice? I tried it ( <?php phpinfo(); ?>), but it doesn't seem to work. Javascript appears to work, though.
Simon Lloyd
08-16-2012, 04:18 AM
You could use the php script in a plugin assign it a variable and use that variable in the notice.
Cyburbia
08-18-2012, 03:10 AM
You could use the php script in a plugin assign it a variable and use that variable in the notice.
Sorry to be a pest, but how would I assign the script in a plugin a variable? THanks!
You could create a plugin using hook parse_templates, and code like this:
ob_start();
phpinfo();
$phpinfo = ob_get_contents();
ob_end_clean();
vB_Template::preRegister('template_name', array('phpinfo' => $phpinfo));
Of course you want to change 'template_name' to the name of the template you want to insert the code in. Then in that template you can use
{vb:raw phpinfo}
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.