custom css per mediawiki

Use this forum to ask questions about how to do things in GuMax skin.

custom css per mediawiki

Postby tut » January 14th, 2012, 8:53 pm

Hi

I have mediawiki farm and use gumax template on all of them.

For example:

Main.css in gumax skin directory will be for global skin settings and gumax_template.css will be for individual wiki, so I will need gumax_template_firstwiki.css, gumax_template_secondwiki.css, gumax_template_thirdwiki.css, ...
now how do I achieve that for every particular wiki is the correct css file loaded?
User avatar
tut
Rank 3
Rank 3
 
Posts: 18
Joined: November 22nd, 2011, 4:29 pm

Re: custom css per mediawiki

Postby Paul » January 14th, 2012, 10:58 pm

Easy way is manually adding each to the "gumax_main.css" for each wiki accordingly.

For example:

First wiki, gumax_main.css might has:
Code: Select all
@import url("main.css");
@import url("gumax_template_firstwiki.css");
User avatar
Paul
Development Team Leader
Development Team Leader
 
Posts: 1132
Joined: October 20th, 2007, 2:23 pm

Re: custom css per mediawiki

Postby tut » January 15th, 2012, 1:50 am

I need one directory with gumax skin only. It should be somethong like this

Code: Select all
switch ($_SERVER["SERVER_NAME"])
        {
                case "firstwiki.mysite.eu":
                        require_once "gumax_template_firstwiki.css";
                        break;
 
                case "secondwiki.mysite.eu":
                        require_once "gumax_template_secondwiki.css";
                        break;
                  
      case "thirdwiki.mysite.eu":
                        require_once "gumax_template_thirdwiki.css";
                        break;
        }


Advise please.
User avatar
tut
Rank 3
Rank 3
 
Posts: 18
Joined: November 22nd, 2011, 4:29 pm

Re: custom css per mediawiki

Postby Paul » January 15th, 2012, 12:31 pm

Open GuMax.php and find:
Code: Select all
$out->addStyle( 'gumax/gumax_main.css', 'screen' );

Add your logical before that to determine the css file name, replace it with something like this:
Code: Select all
    switch ($_SERVER["SERVER_NAME"])
            {
                    case "firstwiki.mysite.eu":
                            $css_file_name = <CSS_PATH> . "/gumax_template_firstwiki.css";
                            break;
     
                    case "secondwiki.mysite.eu":
                            $css_file_name = <CSS_PATH> . "/gumax_template_secondwiki.css";
                            break;
                     
                    case "thirdwiki.mysite.eu":
                            $css_file_name = <CSS_PATH> . "/gumax_template_thirdwiki.css";
                            break;
            }

$out->addStyle(  <CSS_PATH> . '/main.css', 'screen' );
$out->addStyle(  $css_file_name, 'screen' );
User avatar
Paul
Development Team Leader
Development Team Leader
 
Posts: 1132
Joined: October 20th, 2007, 2:23 pm

Re: custom css per mediawiki

Postby tut » January 26th, 2012, 10:34 am

It works well. Thank.
User avatar
tut
Rank 3
Rank 3
 
Posts: 18
Joined: November 22nd, 2011, 4:29 pm


Return to GuMax 'How Do I' Questions

Who is online

Users browsing this forum: No registered users and 1 guest

cron