Jump to content

Error when attempting to use a table within a block in Page?


MrFisc

Recommended Posts

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;
Link to comment
Share on other sites

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' );

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...