Jump to content

Pages Block contentCount for categories failing


Ibai
 Share

Go to solution Solved by newbie LAC,

Recommended Posts

Hi,

I developed a Block that is working fine for me (as administrator). However, Members and Guest are getting a "EX0" error.

When I point to System Logs I see:

Error: Class name must be a valid object or a string (0)
#0 /home/fmsite/public_html/system/Content/Content.php(498): IPS\Node\_Model->modPermission('view_hidden', Object(IPS\Member), NULL)
#1 /home/fmsite/public_html/system/Content/Item.php(5651): IPS\_Content::modPermission('view_hidden', Object(IPS\Member), Object(IPS\cms\Categories))
#2 /home/fmsite/public_html/applications/cms/sources/Records/Records.php(670): IPS\Content\_Item::canViewHiddenItems(Object(IPS\Member), Object(IPS\cms\Categories))
#3 /home/fmsite/public_html/system/Theme/Theme.php(4319) : eval()'d code(143): IPS\cms\_Records::`(Object(IPS\cms\Categories))
#4 [internal function]: IPS\Theme\content_blocks_7()
#5 /home/fmsite/public_html/applications/cms/sources/Blocks/Block.php(216): call_user_func('IPS\\Theme\\conte...')
#6 /home/fmsite/public_html/applications/cms/widgets/Blocks.php(147): IPS\cms\Blocks\_Block::display(Object(IPS\cms\Blocks\Block), 'vertical')
#7 /home/fmsite/public_html/system/Widget/Widget.php(728): IPS\cms\widgets\_Blocks->render()
#8 /home/fmsite/public_html/system/Theme/Theme.php(824) : eval()'d code(16034): IPS\_Widget->__toString()
#9 /home/fmsite/public_html/system/Theme/SandboxedTemplate.php(58): IPS\Theme\class_core_front_global->widgetContainer('sidebar', 'vertical')
#10 /home/fmsite/public_html/system/Theme/Theme.php(824) : eval()'d code(13609): IPS\Theme\_SandboxedTemplate->__call('widgetContainer', Array)
#11 /home/fmsite/public_html/system/Theme/SandboxedTemplate.php(58): IPS\Theme\class_core_front_global->sidebar('right')
#12 /home/fmsite/public_html/system/Theme/Theme.php(824) : eval()'d code(6055): IPS\Theme\_SandboxedTemplate->__call('sidebar', Array)
#13 /home/fmsite/public_html/system/Theme/SandboxedTemplate.php(58): IPS\Theme\class_core_front_global->globalTemplate('c0113e1cd3e0465...', '\n<div id="elCms...', Array)
#14 /home/fmsite/public_html/system/Dispatcher/Dispatcher.php(166): IPS\Theme\_SandboxedTemplate->__call('globalTemplate', Array)
#15 /home/fmsite/public_html/system/Dispatcher/Standard.php(118): IPS\_Dispatcher->finish()
#16 /home/fmsite/public_html/system/Dispatcher/Front.php(574): IPS\Dispatcher\_Standard->finish()
#17 /home/fmsite/public_html/system/Dispatcher/Dispatcher.php(148): IPS\Dispatcher\_Front->finish()
#18 /home/fmsite/public_html/index.php(13): IPS\_Dispatcher->run()
#19 {main}
  
  
  --------
  
  
#0 /home/fmsite/public_html/init.php(537): IPS\_Log::log('Error: Class na...', 'uncaught_except...')
#1 /home/fmsite/public_html/system/Widget/Widget.php(810): IPS\IPS::exceptionHandler(Object(Error))
#2 /home/fmsite/public_html/system/Theme/Theme.php(824) : eval()'d code(16034): IPS\_Widget->__toString()
#3 /home/fmsite/public_html/system/Theme/SandboxedTemplate.php(58): IPS\Theme\class_core_front_global->widgetContainer('sidebar', 'vertical')
#4 /home/fmsite/public_html/system/Theme/Theme.php(824) : eval()'d code(13609): IPS\Theme\_SandboxedTemplate->__call('widgetContainer', Array)
#5 /home/fmsite/public_html/system/Theme/SandboxedTemplate.php(58): IPS\Theme\class_core_front_global->sidebar('right')
#6 /home/fmsite/public_html/system/Theme/Theme.php(824) : eval()'d code(6055): IPS\Theme\_SandboxedTemplate->__call('sidebar', Array)
#7 /home/fmsite/public_html/system/Theme/SandboxedTemplate.php(58): IPS\Theme\class_core_front_global->globalTemplate('c0113e1cd3e0465...', '\n<div id="elCms...', Array)
#8 /home/fmsite/public_html/system/Dispatcher/Dispatcher.php(166): IPS\Theme\_SandboxedTemplate->__call('globalTemplate', Array)
#9 /home/fmsite/public_html/system/Dispatcher/Standard.php(118): IPS\_Dispatcher->finish()
#10 /home/fmsite/public_html/system/Dispatcher/Front.php(574): IPS\Dispatcher\_Standard->finish()
#11 /home/fmsite/public_html/system/Dispatcher/Dispatcher.php(148): IPS\Dispatcher\_Front->finish()
#12 /home/fmsite/public_html/index.php(13): IPS\_Dispatcher->run()
#13 {main}

My block code is:

 

{{$urlPagina = \IPS\cms\Pages\Page::$currentPage->url();}}

{{$dbId = \IPS\cms\Databases\Dispatcher::i()->databaseId;}}
{{$database = \IPS\cms\Databases::load( $dbId );}}

{{$categoria = \IPS\cms\Databases\Dispatcher::i()->categoryId;}}
{{if $categoria}}
	{{$obj_categoria = \IPS\cms\Categories::load($categoria);}}
{{endif}}

{{$record_id = request.id;}}
{{$recordClass = '\IPS\cms\Records'.$dbId;}}
{{if $record_id}}
	{{$jugador = $recordClass::load($record_id);}}
{{endif}}

{{if $obj_categoria}}
	{{if $obj_categoria->parent()}}
		{{if $obj_categoria->hasChildren()}}
			{{$it_categoria = $obj_categoria;}}
		{{else}}
			{{$it_categoria = $obj_categoria->parent();}}
		{{endif}}
        {{if $it_categoria->can('view')}}
	        <h3 class="ipsWidget_title ipsType_reset">Categorías</h3>
	        <div class="ipsSideMenu ipsCategoriesMenu ipsAreaBackground_reset ipsPad_half">
	          <ul class="ipsSideMenu_list">
	            <li>
	              <a href="{$it_categoria->url()}" class="ipsSideMenu_item ipsTruncate ipsTruncate_line">
	                <span class="ipsBadge ipsBadge_style1 ipsPos_right">
			            {{$count=\IPS\cms\Records::contentCount( $it_categoria );}}{$count}
	                </span>
	                <strong class="ipsType_normal">{$it_categoria->_title}</strong>
	              </a>
	              <ul class="ipsSideMenu_list">
	                {{foreach $it_categoria->children() as $subCategory}}
	                <a href="{$subCategory->url()}" class="ipsSideMenu_item ipsTruncate ipsTruncate_line">
	                  <strong class="ipsPos_right ipsType_small">{{$count=\IPS\cms\Records::contentCount( $subCategory );}}{$count}</strong>
	                  {$subCategory->_title}
	                </a>
	                {{endforeach}}
	              </ul>
	            </li>
	          </ul>
	          <p class="ipsType_center">
	            <a href="{$urlPagina}?show=categories" class="">Mostrar todas &nbsp;<i class="fa fa-caret-right"></i></a>
	          </p>
	        </div>
        {{endif}}
	{{endif}}
{{endif}}

Seems that the \IPS\cms\Records::contentCount() is having issues and I don't what else to try. Also tried with {expression=""}.

Is it a bug in IPS? Am I doing something wrong?

The code is very similar to the cms\widgets\Categories template bit. Though mine is not working.

Cheers,

Ibai

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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