adding themes

adding themes

by alistair kidd -
Number of replies: 18

I know how to add a theme, but when i log in as admin through my local host i cant find the part where it selects what theme i want to use,

can anyone point me in the right direction?

many thanks

Average of ratings: -
In reply to alistair kidd

Re: adding themes

by Mauno Korpelainen -

Moodle 1.7: Administration ► Appearance ► Themes ► Theme Selector

Moodle 1.6: Administration -> Configuration -> Themes

In reply to Mauno Korpelainen

Re: adding themes ???

by Abhishek Prasad -

hi,i'm new to moodle.tried adding new themes in moodle 1.7+.Even though i have unzipped and stored all the files of the new theme in ~/moodle/theme/ folder,they are not available in appearence->theme selector even in administrator mode.Please help me out.Thanks in advance..

 

In reply to Abhishek Prasad

Re: adding themes ???

by Mauno Korpelainen -

There are a couple of possible reasons:

check permissions of that folder (read and write) and config.php of your theme folder. Did you modify some other theme (from previous moodle versions)? Did you edit files with notepad or some other text editor?

Average of ratings: Useful (1)
In reply to Mauno Korpelainen

Re: adding themes ???

by Abhishek Prasad -
hi,my problem got solved.I guess the error was due to using notepad to edit the config file.Can  you please tell me as to why using notepad to edit the php files lead to the problem?? Thanks in advance.Really apprecitiate.
In reply to Abhishek Prasad

Re: adding themes ???

by Mauno Korpelainen -

Notepad is OK but if you add spaces or enters to config files (moodle or themes) after last ?> tags or some important sign is dropped or added to wrong place you may find problems. An other thing is how you save a file. If you just press Save everything is ok. But if you select Save as and the format of the file is txt or character set is not the same as original one tags may change their meaning.

Notepad is much safer than for example Word etc.

In reply to Mauno Korpelainen

Re: adding themes ???

by Karolina Węgrzyn -
Hello!

I have a similar problem, though I haven't changed anything in my theme, yet. According to the documentation I should create a new theme with it's own named subfolder, so for a start I just copied the standard theme and uploaded it under a different name in a new subfolder in themes catalogue. Still I've got the same themes list in admin panel, it doesn't show up.

"check permissions of that folder (read and write)"

Do I need "chmod" 777 ? (I hope I remember correctly the name for permissions to overwrite files).

"and config.php of your theme folder"

Now that's something advanced - all my contact with PHP so far was adding ready made custom modules to phpBB2 script, which was quite easy with simple instructions "find line xyz and replace it with abc" ;) I have no idea what do I need to change in files. What should I do in the config.php file?
In reply to Karolina Węgrzyn

Re: adding themes ???

by Mauno Korpelainen -

Hi Karolina,

you will find more info from http://docs.moodle.org/en/Theme

If you start from Standard theme and copy it with another name, edit README.html with notepad (Change there the name of your theme). Check the list of themes now. Usually there is no need for changing permissions (folders 755 and files 644). There is one "special case", chameleon . Usually moodlers just change header image and some colors. Theme config.php has the info about stylesheets and pix of your theme. You don't need to but you may change these:

$THEME->sheets = array('styles_layout', 'styles_fonts', 'styles_color');

This variable is an array containing the names of all the stylesheet (without .css)files you want included in this theme, and in what order

$THEME->standardsheets = true; 

This variable can be set to an array containing filenames from the *STANDARD* theme.  If the array exists, it will be used to choose the files to include in the standard style sheet. When false, then no files are used. When true or NON-EXISTENT, then ALL standard files are used. This parameter can be used, for example, to prevent having to override too many classes. Note that the trailing .css should not be included eg $THEME->standardsheets = array('styles_layout','styles_fonts','styles_color');

$THEME->parent = ''; 

This variable can be set to the name of a parent theme which you want to have included before the current theme. This can make it easy to make modifications to another theme without having to actually change the files. If this variable is empty or false then a parent theme is not used.


$THEME->parentsheets = false; 

This variable can be set to an array containing filenames from a chosen *PARENT* theme.  If the array exists, it will be used to choose the files to include in the standard style sheet. When false, then no files are used. When true or NON-EXISTENT, then ALL standard files are used. This parameter can be used, for example, to prevent having to override too many classes. Note that the trailing .css should not be included eg $THEME->parentsheets = array('styles_layout','styles_fonts','styles_color');

$THEME->modsheets = true; 

When this is enabled, then this theme will search for files named "styles.php" inside all Activity modules and include them.   This allows modules to provide some basic layouts so they work out of the box. It is HIGHLY recommended to leave this enabled.


$THEME->blocksheets = true; 

When this is enabled, then this theme will search for files named "styles.php" inside all Block modules and include them. This allows Blocks to provide some basic layouts so they work out of the box. It is HIGHLY recommended to leave this enabled.


$THEME->langsheets = false; 

By setting this to true, then this theme will search for a file named "styles.php" inside the current language directory.  This allows different languages to provide different styles.


$THEME->navmenuwidth = 50;

You can use this to control the cutoff point for strings in the navmenus (list of activities in popup menu etc) Default is 50 characters wide.


$THEME->makenavmenulist = false;

By setting this to true, then you will have access to a new variable in your header.html and footer.html called $navmenulist ... this contains a simple XHTML menu of all activities in the current course, mostly useful for  creating popup navigation menus and so on.

$THEME->custompix = false;

If true, then this theme must have a "pix" subdirectory that contains copies of all files from the moodle/pix directory, plus a "pix/mod" directory containing all the icons for all the activity modules. Have a look at other themes with custom pix.

Average of ratings: Useful (1)
In reply to Mauno Korpelainen

Re: adding themes ???

by Karolina Węgrzyn -
Thank you for advice smile
I will check out all these variables and edit ReadMe file, haven't done it.

I just switched to Chameleon and changed colors for test, but still can't load logo. But I use original Chameleon, haven't loaded my theme, yet (I haven't seen your message when I switched to Chameleon). I used this information: http://docs.moodle.org/en/Header_logo but both codes in standard style and in Chameleon headers doesn't have the line 5, they both got "h1 class="headermain" instead of "div class="headermain"; pasting over "h1 class="headermain" the suggested code doesn't work.
In reply to Karolina Węgrzyn

Re: adding themes ???

by Mauno Korpelainen -

Whatever theme you have you need to upload the image to your theme folder first (or have link to some image somewhere in www)

Edit header.html with notepad and find code starting with <div id="header-home"... and copy there a code like

  <div id="header-home" class="clearfix">
        <h1 class="headermain"><img src='<?php echo "$CFG->
wwwroot/theme/" ?>nameofyourtheme/mainLogo.gif' id="mainLogo" alt="<?php echo $heading ?>" /></h1>
       <div class="headermenu"><?php echo $menu ?></div>
    </div>
(here mainLogo.gif is the image you need to have in header and nameofyourtheme is the name of your theme)

or for example

<div id="header-home">
     <div class="headermain"><img src="<?php echo
        $CFG->httpswwwroot.'/theme/'.current_theme() ?>/mainLogo.gif" width="300"
        height="100" alt="mypage" title="mypage" id="logo" /></div>
     <div class="headermenu"><?php echo $menu ?></div>
     </div>

Average of ratings: Useful (2)
In reply to Mauno Korpelainen

Re: adding themes ???

by Karolina Węgrzyn -
I just checked all - everything in config.php looks as you suggested (I haven't changes anything). Editing name in the readme file doesn't help. It must be something on my server part, I need to ask admin on Monday.
For now I'll test the way to upload a logo you explained me and the standard logo style as well. One of these should work. I will just edit existing style, having backup of the original on my HDD.
In reply to Mauno Korpelainen

Re: adding themes ???

by Karolina Węgrzyn -
OK, now I'm sure it's server's fault. I can't upload or change anything through FTP, even if changes are visible on my part in FTP files (when I look at them in FTP client), it doesn't show up on web. But when I changed logo in the Standard Logo style uploading logo image with moodle's file uploader it has worked ("upload a file called logo.jpg or logo.gif in your Site Files (look on the home page)").
Then I have to wait for Monday to test the rest.

Thank you for your help again smile
In reply to Karolina Węgrzyn

Re: adding themes ???

by Mauno Korpelainen -

When you upload with ftp try to use mouse right click over a folder or a file. Most ftp programs show a table where you may add permissions for your folders and files. Sometimes there is a menu for setting permissions and sometimes you must use commands

In reply to Mauno Korpelainen

Re: adding themes ???

by Karolina Węgrzyn -
I use Total Commander, setting permissions there is easy (755 to 777), but it changes nothing. There must be some extra security on server, admin has to switch on his side before I'll be able to do anything through FTP.
Hmmm, but I wasn't changing files permissions, maybe it's that. If not, admin has to act first.
In reply to Karolina Węgrzyn

Re: adding themes ???

by Mauno Korpelainen -

If your server permissions are correct and you still can't see your theme in theme list could you send it to me (zip) to mauno.korpelainen@hyvinkaa.fi

I could check if there is some wrong sign or format. Sometimes reloading browser does help (cache).

Do you have moodle 1.7, 1.6 or 1.5?

In reply to Mauno Korpelainen

Re: adding themes ???

by Karolina Węgrzyn -
I use 1.6 version. I'll do if it still doesn't work tomorrow, though I haven't changed anything in the original style, yet, apart the Readme file and a new folder name.
I always press F5 a few times when I can't see changes or empty cache manually (Firefox empty them every tome I close it), so this should not be the problem.
I'll let you know here or by e-mail smile
In reply to Mauno Korpelainen

Re: adding themes ???

by Karolina Węgrzyn -
We've solved the problem, it wasn't moodle or files nor even server's fault. A human is to blame ;) I'll e-mail you from my sirielle@tlen.pl account.