• twitter image
  • facebook image
  • youtube image
  • linkedin image
Language: CMS Made Simple Czech CMS Made Simple France CMS Made Simple Spain CMS Made Simple Hungary CMS Made Simple Russia CMS Made Simple Netherlands

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Known issues in modules that need fixing
PostPosted: Mon May 19, 2014 8:36 pm 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Tue Oct 19, 2004 6:44 pm
Posts: 8144
Location: Fernie British Columbia, Canada
A: global $gCms

The $gCms variable is provided in scope for module actions, and the install, uninstall, and upgrade methods. However, $gCms no longer exists as a global for any internal lib functions.

This global was long deprecated.

The best replacement is to change:
Code:
global $gCms;

to
Code:
$gCms = cmsms();


B: $gCms->variables

This internal variable was long deprecated, and a long time ago we prevented anybody from actually writing to that array. In 2.0 the array is gone.

Anybody using $gCms->variables stuff will need to find the appropriate replacement.

Replacements are:
Code:
$gCms->variables['admintheme']
becomes
Code:
cms_utils::get_theme_object();

Or better yet.... use the {admin_icon} plugin and {cms_action_url} plugins to create an icon directly in the template. i.e:
Code:
<a href="{cms_action_url module='MyModule' action='something'}">{admin_icon icon='newobject.gif'} {$mod->Lang('new_item')}</a>


C: module tab functions

Somewhere in the 1.10.x or 1.11.x series (I don't wanna look it up), the $module->StartTabContent() and $module->EndTabContent() became smarter, and remembered some state variables. That means you can't do things like:

Code:
$smarty->assign('endtab',$this->EndTab());

and then use {$endtab} in your action template multiple times.

The replacement is to use:
Code:
{tab_header name='tab1' label='Tab 1'}
{tab_header name='tab2' label='Tab 2'}
{tab_start name='tab1'}
SOME CONTENT
{tab_start name='tab2'}
MORE CONTENT
{tab_end}

_________________
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Known issues that need fixing
PostPosted: Wed May 21, 2014 4:38 pm 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Tue Oct 19, 2004 6:44 pm
Posts: 8144
Location: Fernie British Columbia, Canada
Also. Instead of hardcoding the search module
modules should be using:
Code:
cms_utils::get_search_module();

when wanting to add/delete words from the index.

_________________
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Known issues that need fixing
PostPosted: Fri May 30, 2014 3:56 am 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Tue Oct 19, 2004 6:44 pm
Posts: 8144
Location: Fernie British Columbia, Canada
Smarty usage in module constructors

Any module that uses smarty in their constructor must now check for smarty before usage.

i.e:

Quote:
public function __construct()
{
parent::__construct()
$smarty = cmsms()->GetSmarty();
if( !$smarty ) return; // need to now check for smarty
$smarty->assign('foo','bar');
}


This is because modules may be loaded during the install/upgrade process (for upgrading and statistics gathering etc). And you cannot count on the fact that the CMSMS smarty will be available at that time.

_________________
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
A2 Hosting