Search
Membership
Login:
Membership:
- New Today: 0
- New Yesterday: 0
- Overall: 3242
- Latest: GoodNews
People Online:
- Guests: 209
- Total: 209
Creating and Editing Themes in OPN rc1 Topics http://www.openphpnuke.com/system/article/index.php?opnparams=CntdOAI3CmdWNVUx
This guidance is to help you better understand the Theme system for OPN. So
if everything fails at first attempt, do not despair. For everything there
is a solution: Either with second times around or one more night with less
sleep ; )
*Note: This is an
old doc, and I will try to find the build this was released for
asap.
Lets
start with the basic file structure.
First we will create the folders
and files for our New Theme. This will save us time later, and
also allow
you
to
see
step
by step how a Theme is created.
Since this is a demo, our Theme will be called "demo" . Please
keep this name for now, because it will be used throughout this tutorial.
First let's go into our (OPN) root folder, and find a folder named "themes".
In this we add a folder named "demo".
Your folder list should look like this:
OPN_INSTALL_root > themes > demo
In the demo folder we create 4 other folders and 3 files .
Create Folders: plugin, image, LANGUAGE, tpl
Create Files: theme.php, demo.css, opn_item.php
Then open the folder plugin and
create a file named repair.php (leave
blank for now)
and a file named index.php.
Then open the file index.php you just created in
the plugin folder
and write the following into it with any editor:
/*
* OpenPHPNuke: Great Web Portal System
*
* Copyright (c) 2001-2003 by
* Heinz Hombergs heinz@hhombergs.de
* Stefan Kaletta stefan@kaletta.de
* Alexander Weber xweber@kamelfreunde.de
*
* This program is free software. You can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License.
* See LICENSE for details.
*
* This software is based on various code found in the internet
* See CREDITS for details
* If you are an author of a part of opn and not you are not mentioned
* SORRY for that ! We respect your rights to your code, so please send
* an email to devteam@openphpnuke.com we will include you to the CREDITS
asap
*/
if (!defined('_OPN_MAINFILE_INCLUDED')) { include('../../../mainfile.php');
}
$langFile = getLanguageDef($opnConfig['language'],$opnConfig['root_path'].'language/');
include_once($opnConfig['root_path'].'class/class.installer.php');
function demo_DoRemove($module) {
global $user,$opnTables,$opnConfig;
//Only admins can remove plugins
$userinfo = getuserinfo_rights ($user,'user','');
if ($userinfo['user_group'] == 10) {
$inst=new OPN_PluginDeinstaller;
$inst->Module=$module;
$inst->ModuleName='demo';
$inst->ItemDataSaveToCheck= 'themes_demo';
$inst->ItemsDataSave = array('themes_demo');
$inst->DeinstallPlugin();
$opnConfig['opnOutput']->Redirect('/admin.php?fct=plugins');
CloseTheOpnDB ($opnConfig);
}
}
function demo_DoInstall($module,$auto) {
global $user,$opnTables,$opnConfig;
//Only admins can install plugins
$userinfo = getuserinfo_rights ($user,'user','');
if ( (($userinfo['user_group'] == 10) && ($auto==1)) || (($userinfo['user_group']
== 10) && ($auto==0)) ) {
$inst= new OPN_PluginInstaller;
$inst->Module=$module;
$inst->ModuleName='demo';
$inst->ItemDataSaveToCheck= 'themes_demo';
$inst->ItemsDataSave = array('themes_demo');
$inst->MetaSiteTags=FALSE;
$myarr = include_once ($opnConfig['root_path'].$module.'/plugin/repair/setting.php');
$myfunc = $inst->ModuleName.'_repair_setting_plugin';
$myarr = include_once ($opnConfig['root_path'].$module.'/plugin/repair/features.php');
$funcF = $inst->ModuleName.'_repair_features_plugin';
$funcM = $inst->ModuleName.'_repair_middleboxes_plugin';
$funcO = $inst->ModuleName.'_repair_opnboxes_plugin';
$funcS = $inst->ModuleName.'_repair_sideboxes_plugin';
$inst->Features=$funcF();
$inst->Sideboxes=$funcS();
$inst->Middleboxes=$funcM();
$inst->Opnboxes=$funcO();
$inst->PublicSettings=$myfunc (0);
$inst->PrivateSettings=$myfunc (1);
$inst->InstallPlugin();
}
if($auto==0){
$opnConfig['opnOutput']->Redirect('/admin.php?fct=plugins');
CloseTheOpnDB ($opnConfig);
}
}
if(!(isset($op))) {$op = '';}
if(!isset($auto)) {$auto=0;}
switch ($op) {
case 'doremove':
demo_DoRemove ($module);
break;
case 'doinstall':
demo_DoInstall ($module,$auto);
break;}
?>
SAVE THIS FILE!!!
Now we open the folder repair and put in
3 more files.
Files: features.php, index.php, setting.php
After this, we take again the editor and open features.php and write in the
following:
/*
* OpenPHPNuke: Great Web Portal System
*
* Copyright (c) 2001-2003 by
* Heinz Hombergs heinz@hhombergs.de
* Stefan Kaletta stefan@kaletta.de
* Alexander Weber xweber@kamelfreunde.de
*
* This program is free software. You can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License.
* See LICENSE for details.
*
* This software is based on various code found in the internet
* See CREDITS for details
* If you are an author of a part of opn and not you are not mentioned
* SORRY for that ! We respect your rights to your code, so please send
* an email to devteam@openphpnuke.com we will include you to the CREDITS
asap
*/
function demo_repair_features_plugin() {
return array('repair','theme');
}
function demo_repair_middleboxes_plugin() {
return array();
}
function demo_repair_sideboxes_plugin() {
return array();
}
function demo_repair_opnboxes_plugin() {
return array();
}
?>
Do Not forget to SAVE FILE!!
Now we open index.php and write in:
/*
* OpenPHPNuke: Great Web Portal System
*
* Copyright (c) 2001-2003 by
* Heinz Hombergs heinz@hhombergs.de
* Stefan Kaletta stefan@kaletta.de
* Alexander Weber xweber@kamelfreunde.de
*
* This program is free software. You can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License.
* See LICENSE for details.
*
* This software is based on various code found in the internet
* See CREDITS for details
* If you are an author of a part of opn and not you are not mentioned
* SORRY for that ! We respect your rights to your code, so please send
* an email to devteam@openphpnuke.com we will include you to the CREDITS asap
*/
function demo_repair_plugin($module) {
global $opnConfig;
$opnConfig['module']->SetModuleName('demo');
if ($opnConfig['module']->ModuleIsInstalled()) {
$inst=new OPN_PluginInstaller;
$inst->Module=$module;
$inst->ModuleName='demo';
$myarr = include_once ($opnConfig['root_path'].$module.'/plugin/repair/features.php');
$funcF = $inst->ModuleName.'_repair_features_plugin';
$funcM = $inst->ModuleName.'_repair_middleboxes_plugin';
$funcO = $inst->ModuleName.'_repair_opnboxes_plugin';
$funcS = $inst->ModuleName.'_repair_sideboxes_plugin';
$inst->Features=$funcF();
$inst->Sideboxes=$funcS();
$inst->Middleboxes=$funcM();
$inst->Opnboxes=$funcO();
$inst->SetPluginFeature();
unset ($inst);
unset ($funcF);
unset ($funcS);
unset ($funcO);
unset ($funcM);
}
}
?>
Do Not forget to SAVE FILE!!
Now we open setting.php and write in:
/*
* OpenPHPNuke: Great Web Portal System
*
* Copyright (c) 2001-2003 by
* Heinz Hombergs heinz@hhombergs.de
* Stefan Kaletta stefan@kaletta.de
* Alexander Weber xweber@kamelfreunde.de
*
* This program is free software. You can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License.
* See LICENSE for details.
*
* This software is based on various code found in the internet
* See CREDITS for details
* If you are an author of a part of opn and not you are not mentioned
* SORRY for that ! We respect your rights to your code, so please send
* an email to devteam@openphpnuke.com we will include you to the CREDITS asap
*/
function demo_repair_setting_plugin($privat = 1) {
if ($privat==0) {
// public return Wert
return array();
} else {
// privat return Wert
return array();
}
}
?>
Do Not forget to SAVE ALL FILES!!
Now we go back again into our root (demo)
folder and open opn_item.php with an editor, and write into
it the following:
/*
* OpenPHPNuke: Great Web Portal System
*
* Copyright (c) 2001-2003 by
* Heinz Hombergs heinz@hhombergs.de
* Stefan Kaletta stefan@kaletta.de
* Alexander Weber xweber@kamelfreunde.de
*
* This program is free software. You can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License.
* See LICENSE for details.
*
* This software is based on various code found in the internet
* See CREDITS for details
* If you are an author of a part of opn and not you are not mentioned
* SORRY for that ! We respect your rights to your code, so please send
* an email to devteam@openphpnuke.com we will include you to the CREDITS asap
*/
function demo_get_admin_config (&$help) {
global $opnConfig;
$langFile = getLanguageDef($opnConfig['language'],$opnConfig['root_path'].'themes/demo/language/');
$help['config_description'] =_demo_THEME_CONFIGDESC;
$help['description']=_demo_THEME_DESC;
$help['image']='themes/demo/images/img_theme.jpg';
$help['weight']=5;
$help['settings']='';
$help['access']='';
$help['adminpath']='admin/index.php';
$help['access_group']=10;
}
?>
Do Not forget to SAVE FILES!!! Now we still have 3 files to put into the LANGUAGE folder
and to put:
Files: lang-english.php, lang-german.php, lang-german_du.php
In this 3 we write the same thing:
/*
* OpenPHPNuke: Great Web Portal System
*
* Copyright (c) 2001-2003 by
* Heinz Hombergs heinz@hhombergs.de
* Stefan Kaletta stefan@kaletta.de
* Alexander Weber xweber@kamelfreunde.de
*
* This program is free software. You can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License.
* See LICENSE for details.
*
* This software is based on various code found in the internet
* See CREDITS for details
* If you are an author of a part of opn and not you are not mentioned
* SORRY for that ! We respect your rights to your code, so please send
* an email to devteam@openphpnuke.com we will include you to the CREDITS
asap
*/
define('_demo_THEME_DESC','demo');
define('_demo_THEME_CONFIGDESC','demo');
?>
Do Not forget to SAVE FILES!!
Now, if we look
in any other Theme and find the file image for the Theme and to copy the
file img_theme.jpg into our image folder.
If you are uncertain whether you set-up everything correctly, go to administration
panel and then the modules section. In the section topics of modules you
should see your Theme "demo". If it isn't working, then try searching
the error messages to figure out where the error developed.
Part
I of III >>
Written
by: manne @ http://www.openphpnuke.info
Translated to English by: klehman @ http://starzero.com