We use quite dark background colours for some of our block headers and would like to replace the + and - boxes with a white version that is clearer. However the images are always called from the moodle\pix\t\ directory and not from the theme pix directory. I believe this is called from here:
.sideblock .header .hide-show img.hide-show-image {
background: url('../../pix/t/switch_minus.gif') no-repeat bottom;
}
.sideblock.hidden .header .hide-show img.hide-show-image {
background: url('../../pix/t/switch_plus.gif') no-repeat bottom;
}
Am I right that the following PHP functions will not work in CSS
'.$CFG->pixpath.'/t/switch_minus.gif
'.$CFG->pixpath.'/t/switch_plus.gif
Are there any possible solutions to this as we have tried moving all our updates to themes and plugins for simplicity and do not necessarily want white icons with all our themes.
Yours
James
In your own theme's directory, file config.php, set custompix to true and follow the instructions:
$THEME->custompix = true;
/// 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.
Joseph
I have custompix=true set, but the switch icons seem to be hard-coded to a particular location, rather than taking the pixpath variable. I assume this is because CSS won't allow PHP statements.
Yours
James
Well, if you have custompix=true in your theme's config.php file and you have put a complete set of icons in your theme directory, including a \pix\t directory with your own switch_minus.gif and switch_plus.gif icons, there is no reason your theme should not display those rather than the ones from \moodle\pix\t directory.
See e.g. my own Moodle test site http://rezeau.info/moodle/ where those icons are drawn in yellow to stand out against the brown background. They do come from http://rezeau.info/moodle/theme/orangechoc/pix/t/
Joseph
Thanks for that, I think I found the problem.
Your CSS has:
.sideblock .header .hide-show img.hide-show-image {whereas I have built mine on top of the standard theme which has:
background-image:url(pix/t/switch_minus.gif);
}
.sideblock.hidden .header .hide-show img.hide-show-image {
background-image:url(pix/t/switch_plus.gif);
}
.sideblock .header .hide-show img.hide-show-image {
background: url('../../pix/t/switch_minus.gif') no-repeat bottom;
}
.sideblock.hidden .header .hide-show img.hide-show-image {
background: url('../../pix/t/switch_plus.gif') no-repeat bottom;
}
I assume if you turned custompix off, yours would still use the theme's versions rather than default to the original.
Yours
James
Well-done, James!
You did spot the source of the problem. Can't remember if I wrote my CSS like this precisely to solve the problem. You're right, if I turn custompix off I still use my own theme's switch_minus/plus gifs.
Is this a bug which should be reported?
Joseph
Perhaps one of you has a solution to my baffling problem. My server generates lots of errors when my theme looks for the switch_minus.gif. For some reason that I have not been able to fathom, it looks for the file in D:/moodle/theme/pix/t/switch_minus.gif (instead of D:/moodle/pix/t/switch_minus.gif or D:/moodle/theme/themename/pix/t/switch_minus.gif) and then claims it cannot find the file, even though I have copied the pix folder to that location in an effort to get rid of the errors. So Apache claims it cannot find the file when it is bloody well there. I am totally non-plussed.
Rgrds,
Paul.
The location of the switch_minus.gif is hard-coded into your theme using img.hide-show-image. Do you get the errors if you use another theme?
The bold text in my previous post highlights the exact location being looked for, and as far as I can tell anything else will fail. The first example is to use your own theme's pix folder pix/t/, while the second uses the general piz folder ../../pix/t/. If this doesn't help can you post a link to your site or the relevant section from your CSS?
Yours
James
Thanks for your reply the location defined in our color.css is
.sideblock .header .hide-show img.hide-show-image {
background: url('pix/t/switch_minus.gif') no-repeat bottom;
}
.sideblock.hidden .header .hide-show img.hide-show-image {
background: url('pix/t/switch_plus.gif') no-repeat bottom;
}
I think this should make the theme look in its own theme folder. Nonetheless the theme looks for moodle/theme/pix/t/switch_minus.gif and then declares it cannot find it, even though I have put the file in that (faulty) location.
Rgrds,
Paul.
$THEME->custompix = false; to true. Just cutting the ('../../pix/t/switch_plus.gif') does the trick.
This tried on version 1.6.3+