Um, do you only get this error message?
When I put similar code into userfuncs.php, I get:
Fatal error: Uncaught Error: Cannot access protected property XH\PageDataRouter::$model in C:\Users\cmb\Portable_XH\www\cmsimple\userfuncs.php:3 Stack trace: #0 C:\Users\cmb\Portable_XH\www\cmsimple\cms.php(1038): include_once() #1 C:\Users\cmb\Portable_XH\www\index.php(10): include('C:\\Users\\cmb\\Po...') #2 {main} thrown in C:\Users\cmb\Portable_XH\www\cmsimple\userfuncs.php on line 3
That means you can't access $pd_router->model, because that property is not part of the public API (and actually never should have been, but PHP 4 didn't allow to specify that). Instead you can call $pd_router->storedFields(), which should basically return the same info. For backward compatibility with XH < 1.6 you can write a small wrapper function, for instance:
Code: Select all
function getPageDataFields()
{
global $pd_router;
if (method_exists($pd_router, 'storedFields')) {
return $pd_router->storedFields();
} else {
return $pd_router->model->params;
}
}
Or simply inline the code.