1
ladysham
Duplicating a module
  • 2003/11/26 13:21

  • ladysham

  • Quite a regular

  • Posts: 274

  • Since: 2003/11/11


Is there any way to duplicate a module and use it twice in a website? What would need to be changed? Or is this impossible to do?

Kelly Ling

2
Mithrandir
Re: Duplicating a module

Should be possible by changing the module's folder name on the webserver (e.g. newbb and forum)

3
phatjew
Re: Duplicating a module
  • 2003/11/26 13:48

  • phatjew

  • Just popping in

  • Posts: 56

  • Since: 2003/10/8


Wouldn't you also have to duplicate any mySQL tables that are associated with the module? I mean, if I want two distinct news modules, for example, I don't want them storing articles in the same tables, right?

4
Mithrandir
Re: Duplicating a module

make a dublicate module folder - then install that module

Edit: *slapping awake*
Yeah... you'd probably need to change some things in the database queries as well as the sql/mysql.sql file

5
chrisz
Re: Duplicating a module
  • 2003/11/26 13:52

  • chrisz

  • Just popping in

  • Posts: 44

  • Since: 2003/7/9 1


I had thought about doing this for Cjay Content. I've already modified it so that it will work in a different directory than modules/cjaycontent. I'd like to use it for multiple sections, which brings me to my point. It would be great if in module installations you could define the installation directory and table names so you could use the same module for multiple sections. Just my 2 cents.

Chris

6
phatjew
Re: Duplicating a module
  • 2003/11/26 14:01

  • phatjew

  • Just popping in

  • Posts: 56

  • Since: 2003/10/8


Quote:

chrisz wrote:
It would be great if in module installations you could define the installation directory and table names so you could use the same module for multiple sections. Just my 2 cents.

Chris


It is more complicated than that, though. Throughout the code of any given module there are SQL statements with the EXACT names of the tables used. If the tables names are dynamic, every single one of these queries would have to be rewritten to pull the table name from somewhere. Not only would that be complicated, but it could potentially slow down the whole transaction.

One possible solution is to put the table names in the xoops_version.php file that is unique to each module, and make sure that each individual copy of the module has different table names. Then, the SQL statements could be rewritten to pull the table names from xoops_version instead of being hardcoded. Again, though, this involves a lot of dev work for EACH INDIVIDUAL MODULE. There is NO WAY to do this for all modules just by changing something the XOOPS core or kernel, I believe. It has to be done on an individual module basis.

7
ladysham
Re: Duplicating a module
  • 2003/11/26 15:17

  • ladysham

  • Quite a regular

  • Posts: 274

  • Since: 2003/11/11


Thanks for all the good information. Now I have another question.

I am duplicating the core news module and calling it news-vendors since it will be only about vendors and their news items. I have gone through all the files and modified them to reflect the new directory (called news-vendors) and also modified the MySQL installation file so that it will create the new files.

However, when I go to install the module, I get an error message that the module news has already been created. Am I missing something in an installation file somewhere?

Thanks!

Kelly Ling

8
phatjew
Re: Duplicating a module
  • 2003/11/26 16:01

  • phatjew

  • Just popping in

  • Posts: 56

  • Since: 2003/10/8


Quote:

ladysham wrote:

However, when I go to install the module, I get an error message that the module news has already been created. Am I missing something in an installation file somewhere?

Thanks!

Kelly Ling



There may be at least one more line in xoops_version.php, like $modversion['name'], that needs to be changed. I don't know if the name of a module is a unique field, but it might be.

However, I'll repeat my warning that it still may not work as two differnt modules if they are still going after the same tables in the database. If you truly want the two copies to be seperate, you will have to change the SQL statements throughout the module's code, as well as the install sql file.

Login

Who's Online

258 user(s) are online (154 user(s) are browsing Support Forums)


Members: 0


Guests: 258


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits