Creating and Editing Themes in OPN rc1

OPN ThemesMy Theme - first steps to the creating your own Theme based on the CSS Theme layout in OPN RC1.

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


Posted by klehman on 2003-12-14 00:08:41  (28407 * reads) 

Read More... 2348 Wörter 1 comment       Auf Facebook posten http://www.openphpnuke.com/system/article/index.php?opnparams=CntdOAI3CmdWNVUx

Happy Birthday dear Bdragon

OPN DEV NewsAlso watch this little, nice and sweet pink dragon :-)

Best wishes and good luck for the future

OPN Dev Team




Posted by manne on 2003-12-13 07:40:23  (12188 * reads) 

Read More... 14 Wörter comments?      Auf Facebook posten http://www.openphpnuke.com/system/article/index.php?opnparams=CntdOAI3CmdWNVUy

Happy Birthday dear DigitalPixel

OPN DEV News
......and as you are one of our "picassos " of the site, you get a very special cake :-)

Best wishes

OPN Dev Team

...

Posted by manne on 2003-11-30 16:32:21  (11885 * reads) 

Read More... 14 Wörter comments?      Auf Facebook posten http://www.openphpnuke.com/system/article/index.php?opnparams=CntdOAI3CmdWNVUz

An example for the module "Themegroups"

OPN FAQ
I made an example on this webpage. Have a look at the upper right corner. There is a box called Themegroups. In this box you can choose
  • All
  • Friends
  • Friends have gone


I also made a sidebox in the right upper corner named Hi Friends.


Now choose Friends have gone in the Themegroups Box and click Pages. What happens? --> The sidebox Hi Friends disappeared.

Now choose Friends in the Themegroup Box , click Pages and the Hi Friends Box will be shown.
The same if you choose All and click Pages

What have you seen? In OPN you can switch off and on boxes, depending on some kind of category which you can define in the admin of the module themegroups.

How can this be done? Define themegroups in the module themegroups. When you define a box in admin sidemenu or centermenu you can define at item "Category" wether it shall be shown in a distinct themegroup. In my example i defined a HTML Box as sidebox, named it "Hi Friends" and in "Category" I choosed "Friends". In this case the box will be displayed if themegroups is choosen "All" or "Friends"

Give this feature a try, perhaps you have gotten a better example, let me know and I put it in the documentation.

Help appreciated :-)

manne

P.S. In RC2 you can choose the themegroup which will be used when OPN is started. A lot of ideas ar feasible then :-) Think about it.

Posted by manne on 2003-11-29 21:40:28  (23464 * reads) 

Read More... 234 Wörter 1 comment       Auf Facebook posten http://www.openphpnuke.com/system/article/index.php?opnparams=CntdOAI3CmdWNVU0

If you have problems in downloading from this site

OPN NewsIf you have problems downloading files from this site, please check:
  • Did you deactivate the transmission of the referer in the browser?
  • Did you deactivate the transmission of the referer in your firewall?
  • Do you use an anonymous proxy?


The above items will cause a failure in downloading.

Please switch on referers and/or don`t use an anonymous proxy.




It´s only because this site is guarded against deep linking.

Enjoy downloading and working with OPN

manne

Posted by manne on 2003-11-24 10:22:03  (20489 * reads) 

Read More... 24 Wörter comments?      Auf Facebook posten http://www.openphpnuke.com/system/article/index.php?opnparams=CntdOAI3CmdWNVU1

Browse in our articles

 
Page took 0.08327 seconds to load