4
Here are some links to the wiki. (but i noticed that the first link 'XoopsInstallUninstall' that a different variable is passed . compared to the 'DatabaseTables' link
http://dev.xoops.org/modules/phpwiki/index.php/XoopsInstallUninstall (info on the on functions)
http://dev.xoops.org/modules/phpwiki/index.php/DatabaseTables (a little bit of more info)
http://dev.xoops.org/modules/phpwiki/index.php/ModVersion (mostly info on the xoops_version.php File. but also has more info about onInstall and stuff)
here is an example from a file that is used by a module with the onInstall function.
[color=006600] /** xmspotlight onInstall Function . Used in xoops_version.php at module install time
*
**/ [/color]
function xoops_module_install_xmspotlight(&$module){
global $xoopsDB;
[color=006600]//add field in stories table for link to img for article or spotlight.[/color]
if (!FieldExists('imgspotlight',$xoopsDB->prefix('stories'))) {
[color=006600] // Adds Field to the table [i]prefix[/i]_stories[/color]
$sql = sprintf("ALTER TABLE ".$xoopsDB->prefix('stories'). " ADD imgspotlight varchar(255) NOT NULL default ' ' ");
$result = $xoopsDB->query($sql);
}
//add field in stories table for text for img credits
if (!FieldExists('imgauthor',$xoopsDB->prefix('stories'))) {
$sql = sprintf("ALTER TABLE ".$xoopsDB->prefix('stories')." ADD imgauthor varchar(255) NOT NULL default ' ' ");
$result = $xoopsDB->query($sql);
}
return true;
}
/**
* Taken from News Module.
* Description: Checks if field exists in a table
**/
function FieldExists($fieldname,$table)
{
global $xoopsDB;
$result=$xoopsDB->queryF("SHOW COLUMNS FROM $table LIKE '$fieldname'");
return($xoopsDB->getRowsNum($result) > 0);
}
hope that helps some.
CBB / LatestNews / Publisher / XM-Spotlight
(ノ◕ヮ◕)ノ*:・゚✧