function news_TableExists($tablename){
global $xoopsDB;
$result=$xoopsDB->queryF("SHOW TABLES LIKE '$tablename'");
return($xoopsDB->getRowsNum($result) > 0);
}
global $xoopsDB;
// 1) Create, if it does not exists, the config_theme table
if(!news_TableExists($xoopsDB->prefix('config_theme'))){
$sqlinstall = 'CREATE TABLE '.$xoopsDB->prefix('config_theme')." (
conf_id smallint(5) unsigned NOT NULL AUTO_INCREMENT,
conf_modid smallint(5) unsigned NOT NULL DEFAULT '0',
conf_catid smallint(5) unsigned NOT NULL DEFAULT '0',
conf_name varchar(25) NOT NULL DEFAULT '',
conf_title varchar(255) NOT NULL DEFAULT '',
conf_value text,
url varchar(255) DEFAULT NULL,
conf_desc varchar(255) NOT NULL DEFAULT '',
conf_formtype varchar(15) NOT NULL DEFAULT '',
conf_valuetype varchar(10) NOT NULL DEFAULT '',
conf_order smallint(5) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (conf_id),
KEY conf_mod_cat_id (conf_modid,conf_catid),
KEY conf_order (conf_order)
) ENGINE=MyISAM;";
if (!$xoopsDB->queryF($sqlinstall)) {
echo '
install failed1';
}else{
echo '
table config_theme est installé
';
$new = 'a:2:{i:0;a:3:{s:4:"type";s:6:"column";s:4:"size";s:3:"1/4";s:6:"fields";a:1:{s:7:"content";s:4:"test";}}i:1;a:3:{s:4:"type";s:6:"column";s:4:"size";s:3:"1/4";s:6:"fields";a:1:{s:7:"content";s:4:"iiii";}}}';
$sqltemplateinsert = "INSERT INTO " . $xoopsDB -> prefix('config_theme') . " (conf_id, conf_catid, conf_name, conf_value) VALUES ('1', '3', 'template', '$new')";
$resultsqltemplate = $xoopsDB->queryF($sqltemplateinsert);
if(!$resultsqltemplate){
echo 'probleme_INSERT_config_template' ;
}else{
echo 'INSERT_config_template_ok' ;
}
}
}else{
echo '
table config_theme déjà installé
';
}
// 1) Create, if it does not exists, the config_theme_menu table
if(!news_TableExists($xoopsDB->prefix('config_theme_menu'))){
$sqlinstall2 = 'CREATE TABLE '.$xoopsDB->prefix('config_theme_menu')." (
id int(11) NOT NULL AUTO_INCREMENT,
catmenu varchar(60) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
label varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
link varchar(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '#',
image varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
parent int(11) NOT NULL DEFAULT '0',
sort int(11) DEFAULT NULL,
PRIMARY KEY (id)
) ENGINE=MyISAM;";
if (!$xoopsDB->queryF($sqlinstall2)) {
echo '
install failed2';
}else{
echo '
table config_theme_menu est installé
';
}
}else{
echo '
table config_theme_menu déjà installé
';
}
the first table is a copy of config table of xoops with the config of theme. the second is for storing menus and sliders.
==> after official release we can integrate this with all theme by copying admin folder and 4 file php. I will explan this after finish.
I can't reproduce the error, it looks like a probleme with php version.
I can't see how can i do this with a module, perheps we can have a link or a redirect to admin folder in the interface of xoops. I will think of this