Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted September 5, 20186 yr I'm trying to use a block to display a Table of data using some custom data, however whenever I do i'm getting this error. It's strange to me that I would get this error on the default IPS theme. Any suggestiosn? Notes: This is on an unedited version of the default IPS theme This is running in `front` not `admin`. This is running on IPS 4.3.4 The error: Error: Class name must be a valid object or a string in /var/www/html/system/Theme/Theme.php(824) : eval()'d code:1317 Stack trace: #0 /var/www/html/system/Theme/SandboxedTemplate.php(58): IPS\Theme\class_core_front_tables->rows(Object(IPS\Helpers\Table\Custom), Array, Array) #1 /var/www/html/system/Theme/Theme.php(824) : eval()'d code(2703): IPS\Theme\_SandboxedTemplate->__call('rows', Array) #2 /var/www/html/system/Theme/SandboxedTemplate.php(58): IPS\Theme\class_core_front_tables->table(Object(IPS\Helpers\Table\Custom), Array, Array, NULL, false) #3 [internal function]: IPS\Theme\_SandboxedTemplate->__call('table', Array) #4 /var/www/html/system/Helpers/Table/Table.php(548): call_user_func(Array, Object(IPS\Helpers\Table\Custom), Array, Array, NULL, false) #5 /var/www/html/applications/cms/sources/Blocks/Block.php(202) : eval()'d code(18): IPS\Helpers\Table\_Table->__toString() #6 /var/www/html/applications/cms/sources/Blocks/Block.php(202): eval() #7 /var/www/html/system/Theme/Theme.php(4319) : eval()'d code(9): IPS\cms\Blocks\_Block::display(Object(IPS\cms\Blocks\Block)) #8 [internal function]: IPS\Theme\content_pages_4() #9 /var/www/html/applications/cms/sources/Pages/Page.php(1218): call_user_func('IPS\\Theme\\conte...') #10 /var/www/html/applications/cms/sources/Pages/Page.php(2198): IPS\cms\Pages\_Page->getHtmlContent() #11 /var/www/html/applications/cms/modules/front/pages/page.php(73): IPS\cms\Pages\_Page->output() #12 /var/www/html/applications/cms/modules/front/pages/page.php(43): IPS\cms\modules\front\pages\_page->view() #13 /var/www/html/system/Dispatcher/Controller.php(96): IPS\cms\modules\front\pages\_page->manage() #14 /var/www/html/applications/cms/modules/front/pages/page.php(33): IPS\Dispatcher\_Controller->execute() #15 /var/www/html/system/Dispatcher/Dispatcher.php(146): IPS\cms\modules\front\pages\_page->execute() #16 /var/www/html/index.php(13): IPS\_Dispatcher->run() #17 {main} The code I use in my block to generate the error: //<?php $tmTableData = []; $tmTableData[] = [ 'Rep Received' => 100, 'Reason' => 'Because', 'Given By' => 1, 'Given On' => date('Y-m-d H:m:i', time(NULL)) ]; $tmTableData[] = [ 'Rep Received' => 100, 'Reason' => 'Because', 'Given By' => 1, 'Given On' => date('Y-m-d H:m:i', time(NULL)) ]; $table = new \IPS\Helpers\Table\Custom($tmTableData, new \IPS\Http\Url('https://di.community/tester', false)); echo $table;
September 5, 20186 yr You need to set a template in front end: $table->rowsTemplate = array( \IPS\Theme::i()->getTemplate( 'your_group', 'your_app', 'front' ), 'templateName' );
September 5, 20186 yr Author 3 minutes ago, Adriano Faria said: You need to set a template in front end: $table->rowsTemplate = array( \IPS\Theme::i()->getTemplate( 'your_group', 'your_app', 'front' ), 'templateName' ); This isn't a custom application. This is being used in a block in the pages application. Do i still need to set that? When examining the \IPS\Helpers\Table\Table class on line 286 I can see it's defaulting to: $this->rowsTemplate = array( \IPS\Theme::i()->getTemplate( 'tables', 'core' ), 'rows' );
September 5, 20186 yr I'm not sure how you will do it but Tables needs a row template in front-end. Probably Pages already has one. You better wait for someone else to help.
September 5, 20186 yr Author Just now, Adriano Faria said: I'm not sure how you will do it but Tables needs a row template in front-end. Probably Pages already has one. You better wait for someone else to help. See my edit, it looks like it's already setting one by default.
September 5, 20186 yr Add: $table->rowsTemplate = array( \IPS\Theme::i()->getTemplate( 'tables', 'core' ), 'rows' ); below your table definition to see if it works.
September 5, 20186 yr Author 10 minutes ago, Adriano Faria said: Add: $table->rowsTemplate = array( \IPS\Theme::i()->getTemplate( 'tables', 'core' ), 'rows' ); below your table definition to see if it works. Still get the same error 😕
September 5, 20186 yr Wait for someone else. I'm not sure how exacly Pages works as I don't use it like that (only DB).
September 7, 20186 yr On 9/6/2018 at 12:24 AM, MrFisc said: This isn't a custom application. This is being used in a block in the pages application. Do i still need to set that? When examining the \IPS\Helpers\Table\Table class on line 286 I can see it's defaulting to: $this->rowsTemplate = array( \IPS\Theme::i()->getTemplate( 'tables', 'core' ), 'rows' ); That template uses for content items.
Archived
This topic is now archived and is closed to further replies.