Error in goblue theme

Peter Lane Posted in Component Development 1 year ago

I am getting this PHP error frequently in using the module page in my component.

https://prod.localapp.live/home PHP Warning:   Undefined array key "title" in /var/www/vhosts/localapp.live/prod.localapp.live/themes/goblue/plugins/default/theme/page/layout/module.php on line 17

This is my related ossn_com.php:

function mapping_init(): void
{
    if (ossn_isLoggedin()) {
        ossn_register_page('mapping','mapping_pagehandler');
    }
}
function mapping_pagehandler(): void
{
   if (!ossn_isLoggedin()) {
        header("Location: https://".$_SERVER['SERVER_NAME']);
        exit;
   }
   $title = ossn_print('com:ossn:mapping');
   $contents['content'] = ossn_plugin_view('pages/mappingpage');
   $content = ossn_set_page_layout('module', $contents);
   echo ossn_view_page($title, $content);
}
ossn_register_callback('ossn', 'init', 'mapping_init');
Replies
Dutch David Vaughan Replied 12 months ago

The solution worked for me thanks to the community and the members for the solution. PaybyPlateMa

gb Peter Lane Replied 1 year ago

That's fixed it, thanks!

Indonesian Arsalan Shah Replied 1 year ago

You need to pass title to contents too

   $title = ossn_print('com:ossn:mapping');
   $contents['content'] = ossn_plugin_view('pages/mappingpage'); 
   $contents['title'] = $title;
   $content = ossn_set_page_layout('module', $contents);

Further instead of header()..exit();

Use

redirect(REF);