CMS Made Simple Forums

Getting cgcalendar categories failing
Page 1 of 1

Author:  webform [ Wed Sep 05, 2018 10:29 pm ]
Post subject:  Getting cgcalendar categories failing

I use to could retrieve a list of cgcalendar categories, but after a change of host and updating CMSMS and modules it fails.

I have an UDT retrieve the cgcalendar categories:
* Get list of CGCalendar categories and assign to Smarty variable.
* @params   string   $params['assign']   Mandatory. Name of variable to assign result

$assign = trim($params['assign']);

if (!empty($assign)){
   $gCms = cmsms(); // global $gCms;
   $db = $gCms->GetDB(); // cms_utils :: get_db();
   $smarty = $gCms->GetSmarty(); // cms_utils :: get_smarty();
   $dbresult = FALSE;

   $query = 'SELECT * FROM `'.cms_db_prefix().'module_cgcalendar_categories` ORDER BY `category_order`, `category_name`, `category_id`';
   $dbresult = $db->GetArray($query);
      $smarty->assign($assign, $dbresult);

And a CGCalendar Event List Template:
{* udt call *}
{get_cgcalendar_categories assign='cgc_cats'}
{if !empty($cgc_cats)}
{foreach from=$cgc_cats item='cgc_cat' name=cat}
{if $cgc_cat.category_name != 'Til godkendelse'}

But my output is now displaying an error message:
Notice: Undefined property: Smarty_CMS::$smarty in /var/www/ on line 1423

Fatal error: Uncaught Error: Call to a member function init() on null in /var/www/ Categories Output.php:29 Stack trace: #0 /var/www/ content_5b902885a03159_55368675(Object(Smarty_CMS)) #1 /var/www/ Smarty_Template_Resource_Base->getRenderedTemplateCode(Object(CMS_Smarty_Template)) #2 /var/www/ Smarty_Template_Compiled->render(Object(CMS_Smarty_Template)) #3 /var/www/ Smarty_Internal_Template->render(false, 1) #4 /var/www/ Smarty_Internal_TemplateBase->_execute(Object(CMS_Smarty_Template), NULL, NULL, NULL, 1) #5 /var/www/ in /var/www/ Categories Output.php on line 29

Something is changed and i can't figure out what? The error message disappear if i delete the foreach, so i guess that narrows it somewhat down?

Cms Version: 2.2.8
Installed Modules:
AdminSearch: 1.0.4
CGCalendar: 2.5.1
CGExtensions: 1.61.1
CGSimpleSmarty: 2.1.8
CGSmartImage: 1.22.2
CMSContentManager: 1.1.6
CMSMailer: 6.2.14
CmsJobManager: 0.1.3
CustomGS: 3.2
DesignManager: 1.1.4
FileManager: 1.6.7
FilePicker: 1.0.3
FrontEndUsers: 2.12
Gallery: 2.3.2
JMFilePicker: 1.0.1
LISE: 1.3.1
LISEInfoScroller: 1.3.1
MenuManager: 1.50.3
MicroTiny: 2.2.2
ModuleManager: 2.1.4
Navigator: 1.0.9
News: 2.51.4
Search: 1.51.5

Config Information:
max_upload_size: 256000000
url_rewriting: mod_rewrite
query_var: page
auto_alias_content: true
locale: da_DK.utf8
set_names: true
timezone: Europe/Copenhagen
permissive_smarty: true

Php Information:
phpversion: 7.0.31
md5_function: On (True)
json_function: On (True)
gd_version: 2
tempnam_function: On (True)
magic_quotes_runtime: Off (False)
E_ALL: 22487
test_file_timedifference: No time difference found
test_db_timedifference: No time difference found
create_dir_and_file: 1
memory_limit: 1024M
max_execution_time: 60
register_globals: Off (False)
output_buffering: On
test_remote_url: Success
file_uploads: On (True)
post_max_size: 256M
upload_max_filesize: 256M
session_save_path: /tmp (0700)
session_use_cookies: On (True)
xml_function: On (True)
xmlreader_class: On (True)
check_ini_set: On (True)
curl: On

Performance Information:
allow_browser_cache: Off (False)
browser_cache_expiry: 60
php_opcache: On (True)
smarty_cache: Off (False)
smarty_compilecheck: Off (False)
auto_clear_cache_age: On (True)
Server Information:
Server Software: Apache
Server Api: litespeed
Server Os: Linux 2.6.32-896.16.1.lve1.4.54.el6.x86_64 On x86_64
Server Db Type: MySQL (mysqli)
Server Db Version: 5.7.22
Server Db Grants: Found a "GRANT ALL" statement that appears to be suitable

Permission Information:
tmp: /var/www/ (0777)
tmp_cache: /var/www/ (0777)
templates_c: /var/www/ (0755)
modules: /var/www/ (0777)
uploads: /var/www/ (0777)
File Creation Mask (umask): /var/www/ (0777)
config_file: 0444

Author:  webform [ Thu Sep 06, 2018 11:31 am ]
Post subject:  Re: Getting cgcalendar categories failing  Topic is solved

OK! I figured it out. It was this line in my UDT, that needs to be removed:
$smarty = $gCms->GetSmarty(); // cms_utils :: get_smarty();
And now, i again get my list of CGCalendar categories ;D

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group