User Login    
 + Register
  • Main navigation
Login
Username:

Password:


Lost Password?

Register now!
Documentation
Who's Online
133 user(s) are online (10 user(s) are browsing XoopsWiki)

Members: 3
Guests: 130

julius-leo, trabis, bravo, more...
[Main Page]

DevWiki AdminThemingHowTo

From XOOPS Project

Main Page | Recent changes | Edit this page | Page history | Switch to MediaWiki mode

Printable version | Disclaimers | Privacy policy
Category: DevWiki

DevWiki Index

Contents

Admin theming how-to

Note: the feature is still under development, so don't try this right now ;-). The definitive implementation will be easier to use.

OK, here we go for a little tut and a few recommendations about how to use the admin theming feature.

I extensively commented the /class/adminui.php file, so you may want to have a look at it also.

To make a custom admin UI, you should create a class extending XoopsAdminUI and overload specific methods depending on the content you want to customize (see the two sample I added to my archive to see how this can be used):

XoopsAdminUI::cp_header()

is the one called by xoops_cp_header(). It will setup output buffering, generate meta / script / stylesheet tags, and then call XoopsAdminUI::cp_header_head() and XoopsAdminUI::cp_header_body()

XoopsAdminUI::cp_header_head()

is just here so you can overload it to write custom content within the <head> tag.

XoopsAdminUI::cp_header_body()

is the function that should write the opening <body> tag and html before the actual content.

XoopsAdminUI::cp_footer()

is then called by xoops_cp_footer(). So overload this one to generate the bottom of your page.


For those of you who are not used to object-oriented programming, I also hope it will give you a good example of how it can be used, as it shows how you can "overload" a class customizing its functionality and still use the base class methods (so we're not just replacing the methods but instead "enhancing" them).


  • Your custom admin UIs should then be installed in /modules/system/admin_ui/cp_mytheme.php
  • As a general rule, you should also assign an instance of your class to the global variable $xoopsAdminUI at the end of your cp file.


i.e: $GLOBALS['xoopsAdminUI'] =& new MyAdminClass('themename');


  • The cp_functions.php file will then include the correct cp_xxxxx.php file according to system prefs / query parameters.
  • Your theme class should support 3 'display modes' (see the $displayMode property and the cp_header() method doc).


When using: XOOPSADMIN_SHOW_HEAD, it should not generate any <body> content. This is intended to allow modules to make dialog boxes (so the correct js / css files will be included, but no content generated) XOOPSADMIN_SHOW_CONTENT, it should generate a "normal" admin page, but (if possible) without any navigation related elements. I added this one because it will facilitate making frame-based admin UIs, or nice toys (like a Mozilla sidebar giving access to the administration menu ) XOOPSADMIN_SHOW_FULL should output a full admin page (with navbars, etc...)


Now, for the themes content by themselves:


  • The theming system will include a specific css file on a per-module basis. You should put this file in /modules/mymod/admin/style.css if you want it included.

It allows you to add things like this in your own css file: form#pathconfig td.head { width: 30%; } (Hehe, I know someone who will like this one )

  • The tag containing the main content should be of class "content" and also use the current module name (the one is optional, but I really like the idea):

<div class="content wfsection"> This will allow "theme writers" to change the look of different sections.


  • You module should use the <h1> tag for the main page title (and not <h3> as most do actually)
  • Try not including decorative images using <img> tags in your html, so they can be customized through css (see how I did my buttons in my sample).


I think I'll start a wiki page soon once I get the things more organized, so we can define "standard" classes of buttons/elements to use in our modules (i.e: buttHome, buttNewElement, etc...)

Maybe more on this later, but I'm getting tired so that will be all for today...

Skalpa


Last edited on March 13, 2004 2:12 pm.

DevWiki Index

Retrieved from "http://www.xoops.org/modules/mediawiki/index.php/DevWiki_AdminThemingHowTo"

This page has been accessed 499 times. This page was last modified 02:42, 30 December 2007. Content is available under XOOPS Project.


Local Support Sites
Powered by
XOOPS Code hosted on SourceForge

Powered by PHP



Powered by MySQL

Powered by Smarty

OSI certified

All content on this site is subject to the Creative Commons License
Developers for Hire