Jump to content
  • [Beta1] Uncaught Exception in applications/core/dev/html/front/tables/rows.phtml


    Hello,

    When trying to display a Db table (location=front) I get the following Exception:

    Error: Class name must be a valid object or a string (0)
    #0 /home/bn2468/public_html/system/Theme/Dev/Template.php(151): IPS\Theme\theme_core_front_tables_rows()
    #1 /home/bn2468/public_html/system/Theme/Theme.php(3678) : eval()'d code(527): IPS\Theme\Dev\Template->__call()
    #2 /home/bn2468/public_html/system/Theme/Dev/Template.php(151): IPS\Theme\theme_core_front_tables_table()
    #3 /home/bn2468/public_html/system/Helpers/Table/Table.php(606): IPS\Theme\Dev\Template->__call()
    #4 /home/bn2468/public_html/applications/bntest/modules/front/john/reports.php(51): IPS\Helpers\Table\Table->__toString()
    #5 /home/bn2468/public_html/system/Dispatcher/Controller.php(139): IPS\bntest\modules\front\john\reports->manage()
    #6 /home/bn2468/public_html/applications/bntest/modules/front/john/reports.php(29): IPS\Dispatcher\Controller->execute()
    #7 /home/bn2468/public_html/system/Dispatcher/Dispatcher.php(169): IPS\bntest\modules\front\john\reports->execute()
    #8 /home/bn2468/public_html/index.php(16): IPS\Dispatcher->run()
    #9 {main}

    The code is pretty simple - it's a front module:

        protected function manage() : void
        {
            // ?app=bntest&module=john&controller=reports
            
            // generate the report
            $report = new \IPS\Helpers\Table\Db('bntest_test_reports', \IPS\Http\Url::internal('app=bntest&module=john&controller=reports'));
            $report->langPrefix = 'report_';
            $report->include = [
                'name',
                'location',
                'age',
            ];
            $report->title = 'Test Report';
            
            \IPS\Output::i()->output .= (string) $report;
        }
     

    When I do the same with an admin module (which defaults to using applications/core/dev/html/admin/tables/rows.phtml) it works fine. My code is substantially the same (just has a different URL parameter):

        protected function manage() : void
        {
            // admin/?app=bntest&module=reports&controller=reports
            
            // generate the report
            $report = new \IPS\Helpers\Table\Db('bntest_test_reports', \IPS\Http\Url::internal('admin/app=bntest&module=reports&controller=reports'));
            $report->langPrefix = 'report_';
            $report->include = [
                'name',
                'location',
                'age',
            ];
            $report->title = 'Test Report';
            
            \IPS\Output::i()->output .= (string) $report;
        }
     

    The report is trivial test data:

    Could contain: Page, Text

    Thanks very much.

    John


    User Feedback

    Recommended Comments

    Esther E.

    Posted

    The default table templates for the front end assume a Content table as opposed to a Db table. Therefore, the templates work with objects instead of arrays.

    You'll need, as Adriano mentioned, a rowsTemplate in order for it to work. Please do not try to pass it the row template from the admin side, that will trigger a cascading error effect. Best to create a custom one.


×
×
  • Create New...