[SOLVED] Is there a way to duplicate a module?

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
spcherub
Power Poster
Power Poster
Posts: 402
Joined: Fri Jun 06, 2008 5:54 pm

[SOLVED] Is there a way to duplicate a module?

Post by spcherub »

I am using the News module for news items, but would also like to use the same functionality to manage and display author bios. I don't want to use the News module with a separate category because there are custom fields I'd like to add for the bios which are not applicable to the news items.

So here is the question - is there a simple way to create a "duplicate" of the News module, called say "Writers" - created such that it has all the functionality and features of the News module, but uses a different name, different database fields etc. so it can be completely independent of the original module.

I realize I can do a global search and replace of the module code (and rename the module directory), but is there a simpler (or previously implemented) way to go about this?

TIA,
Sanjay
Last edited by spcherub on Sun Oct 18, 2009 1:06 pm, edited 1 time in total.
jmcgin51
Power Poster
Power Poster
Posts: 1899
Joined: Mon Jun 12, 2006 9:02 pm

Re: Is there a way to duplicate a module?

Post by jmcgin51 »

spcherub wrote: I realize I can do a global search and replace of the module code (and rename the module directory), but is there a simpler (or previously implemented) way to go about this?
This is the best/only way to do what you are wanting to do.  It has been done before on News and other modules.  Just make sure you get EVERYTHING changed.
Peciura

Re: Is there a way to duplicate a module?

Post by Peciura »

Why not use CGBlog module? I think it is cut down version of News module. You will be able to edit entries from back end, assign multiple categories, create custom fields, use templates.
spcherub
Power Poster
Power Poster
Posts: 402
Joined: Fri Jun 06, 2008 5:54 pm

[SOLVED] Re: Is there a way to duplicate a module?

Post by spcherub »

Peciura wrote: Why not use CGBlog module? I think it is cut down version of News module. You will be able to edit entries from back end, assign multiple categories, create custom fields, use templates.
Thanks! That is a great idea. I knew there were other "news-inspired" modules out there, but could not find one that fit. So this will suffice for this particular project, but I'm still on the look out for an easy way to "fork" a module. I suppose someone with the scripting chops could come up with a way to "global search/replace" and duplicate modules.

Thanks for the responses.
Jos
Support Guru
Support Guru
Posts: 4019
Joined: Wed Sep 05, 2007 8:03 pm
Location: The Netherlands

Re: [SOLVED] Is there a way to duplicate a module?

Post by Jos »

I have made a script for this once. I have put an example in the Dutch forum that copies the Guestbook modules.

http://forum.cmsmadesimple.org/index.ph ... #msg166748

Give $module the value of the directoryname of the module you would like to copy.
Then you only need to edit the $trans array. In case of news module you would at least need values News, news, Article, article to be replaced. Also don't forget to put the names of constants there as well. If you get an error after you installed the module copy, you did not changed enough values,

Note that you won't be able to do any updates on the module copy!
Last edited by Jos on Sun Oct 18, 2009 1:41 pm, edited 1 time in total.
spcherub
Power Poster
Power Poster
Posts: 402
Joined: Fri Jun 06, 2008 5:54 pm

Re: [SOLVED] Is there a way to duplicate a module?

Post by spcherub »

Thanks Jos - that was exactly what I was looking for. I will give it a shot.

S
Post Reply

Return to “Modules/Add-Ons”