Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
MrFisc Posted September 5, 2018 Posted September 5, 2018 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;
Adriano Faria Posted September 5, 2018 Posted September 5, 2018 You need to set a template in front end: $table->rowsTemplate = array( \IPS\Theme::i()->getTemplate( 'your_group', 'your_app', 'front' ), 'templateName' );
MrFisc Posted September 5, 2018 Author Posted September 5, 2018 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' );
Adriano Faria Posted September 5, 2018 Posted September 5, 2018 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.
MrFisc Posted September 5, 2018 Author Posted September 5, 2018 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.
Adriano Faria Posted September 5, 2018 Posted September 5, 2018 Add: $table->rowsTemplate = array( \IPS\Theme::i()->getTemplate( 'tables', 'core' ), 'rows' ); below your table definition to see if it works.
MrFisc Posted September 5, 2018 Author Posted September 5, 2018 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 😕
Adriano Faria Posted September 5, 2018 Posted September 5, 2018 Wait for someone else. I'm not sure how exacly Pages works as I don't use it like that (only DB).
MrFisc Posted September 6, 2018 Author Posted September 6, 2018 Bump? (idk if bumping posts is okay here, lmk if not)
newbie LAC Posted September 7, 2018 Posted September 7, 2018 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.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.