Duplicating Modules, Components, and Mambots.

Joomla! has a built-in feature for duplicating modules. But duplicating components and associated modules is a tad bit trickier.

Now I have zero coding experience – but this process has worked in the past for me.

First, you’ll need a couple of tools:

1) A robust text editor, capable of searching and replacing through an entire folder and subfolders recursively.

2) A robust file renamer, for renaming files.

Now
you need to open the .xml installer file (in your text editor) included
with the add-on. When you look through it, you’ll see:

1) The name of the component.
2) The database prefixes and tables used by the component.

And this is where things become “dynamic.”  :P But don’t worry – it’s not really that hard.

The
GOAL is to make the SMALLEST possible change in both the name of the
component AND the table prefix in order to create a NEW copy of the
component that acts independently of the old component.

So try
three letters. Find three letters in the table prefix and three letters
in the name of the component, then search and replace them with a
letter sequence that wouldn’t commonly occur. Say you’re replacing
‘ext’ for the extcalendar component. Replace ‘ext’ with ‘xkx’ for
instance.

Now, after you’ve searched and replaced ‘ext’ with
‘xkx’, you’ll want to slap yourself on the head. You just replaced the
common programming term ‘next’ with ‘nxkx’ – and that’s just gonna reak
all kinda havoc.

But you already KNOW that – so you go back then
and replace ‘nxkx’ with ‘next’. See how it works? You screw up, then
you go back and fix your mistakes :)

Okay, so you’ve replaced
‘ext’ with ‘xkx’ throughout the entire folder. Before you make your
next move, you’ll need to use a batch file renamer to do the same to
all of the files within the component’s file structure. Why? Because
the component will be calling files that don’t exist otherwise.

So hey – you’re almost done. Now you zip the file back up and upload it with Mambo’s component uploader.

If the uploader fails, it will tell you which files you forgot to rename :)

Then
you can run the component – and the PHP errors will let you know if you
screwed up anywhere else :) They’ll actually tell you the line numbers,
etc.

If you screwed up, then it’s back to the drawing board –
and you’ll need to start with a different sequence of letters for the
search and replace. But obviously, start with a copy of the ORIGINAL
component folder structure – not the one you just screwed up.

Now
this might all SOUND like it takes a horribly long time – but it really
only takes about 5 minutes, tops. So you can screw up a few times, and
still be way ahead of the game.

And finally, xkx is a horrible
name for a component. So, after you’re done installing and testing to
make sure it works, you’re free sailing all the way home.

Just
search and replace for ‘xkx’ with something that seems normal :) – and
you’ve got a shiny new duplicated component, or module, or mambot.

And
finally, because I didn’t want to make this sound even more difficult
than it already sounds. Trust me – it SOUNDS a LOT harder than it
actually is. Here’s a couple more things:

Use CASE-SENSITIVE
search and replace. In the case of replacing ‘ext’ with ‘xkx’, you’d
search and replace for all variations – the most common being ‘Ext’,
‘ext’, and ‘EXT’. If you don’t do that, you’re likely to run into
problems. Also ALL search and replace executions should take place
through the ENTIRE folder structure for the component or other add-on,
NOT just the installation xml file. The xml file is the KEY to this
whole process, as it will contain EVERY pattern that must be changed –
if it’s not in the xml file, it doesn’t need to be changed.

ALSO:
If you’re running into problems with letter sequences like ‘ext’ – I
had one that used ‘dir’ for instance – remember that you ONLY need to
change the component NAME and the table prefixes. Table prefixes almost
always end with _ – so rather than replacing ext, try ext_. Again, it
sounds like a pain – but it’s not really that hard. And once you get
the swing of it, you’ll be duplicating whatever you like, whenever you
like.

Typing a sequence of 3 letters into a robust text editor
and having it search and replace through an entire folder takes all of
about 3 nanoseconds. It’s blistering fast. So again, you can screw up a
few times, and still probably pull off a perfect duplicate in less than
30 minutes.

About the author

Submit a Comment

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>