About Cloning These Modules Using Our Perl Scripts

By Freeform Solutions


Changelog:

Feb 8 2009 -- updated to include changes in iMenu 3...changes have not been fully tested...please report issues to info@freeformsolutions.ca

May 28 2006 -- updated in conjunction with release of new modules

April 5 2006 -- updated clone_imenu.pl with two bug fixes


We find it very useful to clone these modules. WF-Channel is not designed to handle lots and lots and lots of pages, and also, you can't have two WF-Channel areas in the main menu if you only have one WF-Channel module. By cloning the module you get the nice submenu functionality in the main menu, with all the benefits of the page management that it gives you for multiple sections of your site.

On the other hand, sometimes the main menu is just not right for the site you need to build. There are a lot of custom menu modules out there. We liked the simplicity of iMenu, and added a few features of our own, including sub menus. Now that you can clone iMenu, you can actually have lots of different menus in your site, all with sub menu functionality in them. Multi-menu and other modules do similar things, but we like this cloning approach best, so we're sharing our tools for it with the community.

How to Clone These Modules

First, make sure you have Perl installed in your system

If you are not sure about this, then you probably don't have Perl installed. Therefore, assuming you are using Windows, get a copy of ActiveState Perl here:

http://www.activestate.com/Products/ActivePerl/

Follow the install instructions and you're done.

Second, download the Perl script you need

Third, make sure you have a copy of the original module handy

Fourth, run the script, as follows:

  1. Make a copy of the module folder on your local computer (the idea is to modify this copy and then upload it to your server).
  2. Rename the copy of the module folder that you just made. Don't forget what you renamed it to!
  3. Put a copy of the right clone script inside the renamed folder you just made.
  4. Run the clone script from a command prompt box, with two command line arguments. The first argument is the name of the folder (it must be the exact name of the folder), the second is a human-readable form of the module name. For example:
  5. perl clone.pl aboutus "About Us"

  6. If all goes according to plan, you'll get a message like this: "Cloning complete. About Us module ready for upload."

That's it. Upload the new module and install it and away you go.

If you're cloning WF-Channel, don't forget to CHMOD the permissions on the folders that require that, as per the wfchannel readme.

If you have any questions or run into trouble...

Notes:

These scripts were written using ActivePerl for Windows. I think it will run okay on Linux, but I can't say for sure. If you have problems, it's probably related to the syntax for the paths to files, which should be easy enough to modify and fix.

This script is meant to be run from the new folder you make. I believe if you run it from another location, the paths will be screwed up, depending on your operating system, version of perl, etc. What this means is, make sure the new folder that you made is the active folder when you run the script, ie: if the folder you made is called c:\xoops\modules\aboutus then make sure the DOS prompt is c:\xoops\modules\aboutus> when you run the script.

Or to put it another way, this is good:

c:\xoops\modules\aboutus>perl clone.pl aboutus "About Us"

While this is bad:

c:\>perl c:\xoops\modules\aboutus\clone.pl aboutus "About Us"

Of course, make sure that your new folder name has no spaces!

The admin icon for the modules look exactly like the icon for the original modules, and have their names on them. Not much a perl script can do about that (without all kinds of extra work), but the module name does change to reflect the human readable name you pass in at the command line so that makes it a little easier to tell your different copies apart. Note that we have found that if you do not modify the icons in some way for each copy, then they don't all show up in the Administration Menu!

To make a new icon, get a copy of the Bit3 font that is used for the XOOPS module icon text (or if you don't care about it matching, use any old font), and open up the icon file and edit it.