Cloning module

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
kamesenin
New Member
New Member
Posts: 3
Joined: Tue Jul 26, 2011 1:48 pm

Cloning module

Post by kamesenin »

Hi everyone.
I am hyped over six monthes about CMSMS and it's capabilities, but I have question about 'cloning' modules. I would like to have two (or more) 'News' modules working in content tab with diffrent names (I didn't think about how to manage data base yet - one for all or separately). I tried MoudleMaker and CTLMoudleMaker then editing and adding files from 'News' module, but It didn't work (no respond from cms- pure shutdown). Is there any way to make it simple or I have to start thinking about building module from scratch? Thanks for any advice!

btw. running on: version 1.9.4, php 5.2.17, MySql data base
bess
Language Partners
Language Partners
Posts: 282
Joined: Thu Dec 18, 2008 9:37 am
Location: Bretagne

Re: Cloning module

Post by bess »

why don't you use 1 module : News with lot of categories ?
Jos
Support Guru
Support Guru
Posts: 4019
Joined: Wed Sep 05, 2007 8:03 pm
Location: The Netherlands

Re: Cloning module

Post by Jos »

I believe the ListIt module has the power to copy itself:
http://dev.cmsmadesimple.org/projects/listit2
kamesenin
New Member
New Member
Posts: 3
Joined: Tue Jul 26, 2011 1:48 pm

Re: Cloning module

Post by kamesenin »

@bess: yeah I know there is that option, but what when i would like to make modules (multiple) for other purpose with diffrent name then 'news' and not to get confused ? ;)
@Jos: will check detales, but rather than specify module I am searching for at least hint how to make modification, install and use of existing
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am
Location: Arizona

Re: Cloning module

Post by Dr.CSS »

Use a text editor that has search/replace like PSPad editor to change all instances of news, News, NEWS, use case sensitive mode, in all files, then check each file to rename any that have News/news in them, there are 4 lines that have [nN]ews in News.module.php, all told there are 511 places to change it, then rename the folder and you should be good to go...
Jos
Support Guru
Support Guru
Posts: 4019
Joined: Wed Sep 05, 2007 8:03 pm
Location: The Netherlands

Re: Cloning module

Post by Jos »

or use the search function on this forum and come up with this topic: http://forum.cmsmadesimple.org/viewtopi ... =7&t=38264 8)
kamesenin
New Member
New Member
Posts: 3
Joined: Tue Jul 26, 2011 1:48 pm

Re: Cloning module

Post by kamesenin »

Hi!
After couple hours of diggin I finally achived my goal.
There are two solutions: simple but not efective (will write why) and time consuming for first time.
First one is simply modiffing main PHP for ex. CGBlog.module.php, install.php while replacing name 'CGBlog' to 'SupaBlog' or whatever. Then coping it to 'modules' folder and you got your own module (after intalling it form 'modules' tab). Why not efective ? If it's clon (like in my example) you will get to tabs with the same content (literal). Add something and will show up in both (database).
Secound solution is as Dr.CSS write, PSPad (or any text editor) and file by file checking for name 'CGBlog' (as in example) and rename it to 'SupaBlog'. First catch is case sensetive (once again thx to Dr.CSS) in names esepcial for DB. Secound catch are classes (not every module has them but..) where minimal knowledge is requered to make everything work.
I will work on a script for 'one-click' cloning - nothing more nothing less - for people who wants same resoult as me. Cheers and thank You very mush for help
Jos
Support Guru
Support Guru
Posts: 4019
Joined: Wed Sep 05, 2007 8:03 pm
Location: The Netherlands

Re: Cloning module

Post by Jos »

Guess you didn't read my linked post carefully enough :P
Post Reply

Return to “Developers Discussion”