PDA

View Full Version : Function works in Forum but undefined in CMS


djbaxter
05-02-2010, 03:19 PM
I am using a customization to pull the title of the latest entry in an external blog. See https://vborg.vbsupport.ru/showthread.php?t=234254 for details

This works fine and generates no errors in the Forum.

However, I've now enabled the CMS and when I do that and try to leave a comment I get this error:

Fatal error: Call to undefined function CarpCacheShow() in /path/to/forum/includes/class_postbit.php(277) : eval()'d code on line 2

I assume this means something is not declared properly for the CMS.

The function in question is called in a plugin using the postbit_display_start hook:

ob_start();
CarpCacheShow($post[field6]);
$blogentry = ob_get_contents();
ob_end_clean();
vB_Template::preRegister('postbit',array('blogentr y' => $blogentry));

What do I need to add/change to get CMS to "see" and process this?

(Reposted from http://www.vbulletin.com/forum/showthread.php?350855-Function-works-in-Forum-but-undefined-in-CMS as Lynne suggested)

--------------- Added 1272819511 at 1272819511 ---------------

I've discovered that I can avoid error messages if I use the global_start hook instead of the postbit_display_start hook and add a line like this:

ob_start();
CarpCacheShow($post[field6]);
$blogentry = ob_get_contents();
ob_end_clean();
vB_Template::preRegister('postbit',array('blogentr y' => $blogentry));
vB_Template::preRegister('vbcms_page',array('bloge ntry' => $blogentry));

However, I'm not sure this is an efficient way to do this.

--------------- Added 1272854336 at 1272854336 ---------------

Added: No. That disables the errors on the home page of the CMS but as soon as you click through to one of the articles there are errors again.