Page 1 of 1
[SOLVED] Changes to the content types of CMSms 1.6
Posted: Sun Jun 28, 2009 8:19 pm
by NaN
Hi everybody.
Since something has changed to the content types of the CMSms 1.6 it seems to be that some modules content types (like album module) does not work anymore.
The pages disapear in frontend as well as in backend and the content type is missed in the content type dropdown.
I tried to modify the album content type (adapting to the new content types of CMSms 1.6) but without any effect.
Is the module API still up to date?
Did i miss something?
Re: Changes to the content types of CMSms 1.6
Posted: Sun Jun 28, 2009 9:47 pm
by calguy1000
Since something has changed to the content types of the CMSms 1.6 it seems to be that some modules content types (like album module) does not work anymore.
This was well announced in the release notes and the release announcement.
Re: Changes to the content types of CMSms 1.6
Posted: Sun Jun 28, 2009 11:58 pm
by NaN
Indeed it has been announced.
But not documented yet.
I just wanted to help adapting the album module to CMSms 1.6 since cyberman told me that there are maintainers needed.
But I don't know where to start - or to continue since just adapting the code of the album content type to the code of the new content type of the core seems not to be all.
And always to dig in alien code to find it out by myself... this is weird.
Re: Changes to the content types of CMSms 1.6
Posted: Mon Jul 13, 2009 4:46 pm
by NaN
Oh, please.
Come on.
Just a hint.
A keyword.
Let's say i would be a developer of a module that uses an own content type.
And i now want to adapt my module to the new CMSms version.
What do i have to do?
The only comments i found were that there has been changed this and that to the handling of content types what results in that some modules wont work properly.
But if I adapt exactly theses changes (to the modules content type only) nothing happens.
So this is why i'm asking for any suggestion what also to do.
Re: Changes to the content types of CMSms 1.6
Posted: Tue Jul 14, 2009 5:06 pm
by NaN
Okay,
a forum member told me that the content type in CMSms 1.6 must be registered not in the SetParameters function but in the constructor of the module class.
That's all.
Re: [SOLVED] Changes to the content types of CMSms 1.6
Posted: Sun Aug 16, 2009 3:42 am
by gingercat
OK I see this is marked SOLVED but how did you solve it?
How do I get my Album content back as a content type?
Re: [SOLVED] Changes to the content types of CMSms 1.6
Posted: Sun Aug 16, 2009 4:28 am
by Jeff
An example will be nice.
As for the album module the forge version will not work as a Content Type anymore, since the developer no longer maintains it.
Re: [SOLVED] Changes to the content types of CMSms 1.6
Posted: Sun Aug 16, 2009 4:36 am
by gingercat
ok - this is the site
http://photographicmemory.co.nz/
front end is fine after upgrade - in the back end there is no album content type so I can't get back into the pages or edit the current ones.
album is ver 0.9.3. Is there a current album or a different module I should be using?
Are you saying all albums now need to be added as smarty tags to a standard page? How would I delete the current pages if I can't access them from the back end?
Re: [SOLVED] Changes to the content types of CMSms 1.6
Posted: Tue Aug 18, 2009 2:03 pm
by NaN
Modules before CMSms 1.6 needed to register its content type in the function SetParameters (in the file MODULENAME.module.php):
Code: Select all
$this->RegisterContentType('GuestbookContent',cms_join_path(dirname(__FILE__),'class.GuestbookContent.php'),$this->GetFriendlyName());
This won't work anymore with CMSms 1.6+.
So we need to adapt this call:
Code: Select all
if ($GLOBALS['CMS_VERSION'] < 1.6) {
if (method_exists($this, 'registercontenttype')) {
$this->RegisterContentType('GuestbookContent',cms_join_path(dirname(__FILE__),'class.GuestbookContent.php'),$this->GetFriendlyName());
}
}
This example is for the module Guestbook. You need to adapt module name and path if you adapt any other module.
Here you see it with the pageblocks module:
Code: Select all
if ($GLOBALS['CMS_VERSION'] < 1.6) {
if (method_exists($this, 'registercontenttype')) {
$this->RegisterContentType('PageBlocksContent', dirname(__FILE__) . DIRECTORY_SEPARATOR . 'classes' . DIRECTORY_SEPARATOR . 'class.PageBlocksContent.php', $this->GetFriendlyName());
}
}
So we make sure that the module will still work with CMSms before 1.6.
For newer versions the RegisterContentType() call must be done in the (PHP4-) constructor of the module class.
A constructor in PHP4 is a function that has the same name like the class.
If this function does not exist create it.
Example (Guestbook module):
Code: Select all
function Guestbook() {
$this->CMSModule();
$this->InstalledModules = array();
if ($GLOBALS['CMS_VERSION'] >= 1.6) {
parent::CMSModule();
$this->RegisterContentType('GuestbookContent',cms_join_path(dirname(__FILE__),'class.GuestbookContent.php'),$this->GetFriendlyName());
}
}
And again for PageBlocks:
Code: Select all
function PageBlocks() {
$this->CMSModule();
$this->InstalledModules = array();
if ($GLOBALS['CMS_VERSION'] >= 1.6) {
parent::CMSModule();
$this->RegisterContentType('PageBlocksContent', dirname(__FILE__) . DIRECTORY_SEPARATOR . 'classes' . DIRECTORY_SEPARATOR . 'class.PageBlocksContent.php', $this->GetFriendlyName());
}
}
This should be all.
(Thanks to Andiministrator)
In Guestbook Module i additionally adapted the content type file to the content type of the core.
Re: [SOLVED] Changes to the content types of CMSms 1.6
Posted: Tue Aug 18, 2009 2:05 pm
by calguy1000
Just register the content types from the constructor.... no problems.