CMS Made Simple Forums
https://forum.cmsmadesimple.org/

Getting cgcalendar categories failing
https://forum.cmsmadesimple.org/viewtopic.php?f=7&t=79016
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:
Code:
/**
* 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);
   if(!empty($dbresult)){
      $smarty->assign($assign, $dbresult);
   }
}


And a CGCalendar Event List Template:
Code:
{* 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'}
{$cgc_cat.category_name},
{/if}
{/foreach}
{/if}


But my output is now displaying an error message:
Code:
Notice: Undefined property: Smarty_CMS::$smarty in /var/www/postwork.dk/sisk/lib/smarty/Smarty.class.php on line 1423

Fatal error: Uncaught Error: Call to a member function init() on null in /var/www/postwork.dk/sisk/tmp/templates_c/dfd633e820f864c4c193c0e615e1db89334bd555_0.cms_template.CGCalendar Categories Output.php:29 Stack trace: #0 /var/www/postwork.dk/sisk/lib/smarty/sysplugins/smarty_template_resource_base.php(128): content_5b902885a03159_55368675(Object(Smarty_CMS)) #1 /var/www/postwork.dk/sisk/lib/smarty/sysplugins/smarty_template_compiled.php(172): Smarty_Template_Resource_Base->getRenderedTemplateCode(Object(CMS_Smarty_Template)) #2 /var/www/postwork.dk/sisk/lib/smarty/sysplugins/smarty_internal_template.php(206): Smarty_Template_Compiled->render(Object(CMS_Smarty_Template)) #3 /var/www/postwork.dk/sisk/lib/smarty/sysplugins/smarty_internal_templatebase.php(216): Smarty_Internal_Template->render(false, 1) #4 /var/www/postwork.dk/sisk/lib/smarty/sysplugins/smarty_internal_templatebase.php(122): Smarty_Internal_TemplateBase->_execute(Object(CMS_Smarty_Template), NULL, NULL, NULL, 1) #5 /var/www/postwork.dk/sisk/modules/CGCalen in /var/www/postwork.dk/sisk/tmp/templates_c/dfd633e820f864c4c193c0e615e1db89334bd555_0.cms_template.CGCalendar 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?

Code:
----------------------------------------------
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
JQueryTools: 1.4.0.3
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:
php_memory_limit:
max_upload_size: 256000000
url_rewriting: mod_rewrite
page_extension:
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
E_STRICT: 0
E_DEPRECATED: 0
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
disable_functions:
open_basedir:
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/postwork.dk/sisk/tmp (0777)
tmp_cache: /var/www/postwork.dk/sisk/tmp/cache (0777)
templates_c: /var/www/postwork.dk/sisk/tmp/templates_c (0755)
modules: /var/www/postwork.dk/sisk/modules (0777)
uploads: /var/www/postwork.dk/sisk/uploads (0777)
File Creation Mask (umask): /var/www/postwork.dk/sisk/tmp/cache (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:
Code:
$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
http://www.phpbb.com/