1
m0nty
module DB table sql install help
  • 2005/5/16 17:25

  • m0nty

  • XOOPS is my life!

  • Posts: 3337

  • Since: 2003/10/24


i'm trying to modify a module so that it is as easy as possible to clone.

i have this at the top of my xoops_version.php

$MODULE_DIRNAME = 'xreviews';
$MOD_PREFIX = $MODULE_DIRNAME;

then further down i have:

$modversion['dirname'] = $MODULE_DIRNAME;

$modversion['tables'][0] = $MOD_PREFIX."_reviews";

both these work fine once it's installed as original.

but if i change the dirname to say 'xreviews2' and then try to install the module it tells me that the tables already exist.

this is because in the mysql.sql file i have the following:

CREATE TABLE xreviews_reviews

is there a way i can substitute the prefix in the sql file for the $MOD_PREFIX value when installing?