Posts made by David Scotson

So currently there's the [[pix:theme|name_of_icon]] stuff that does this for icons (with the extra trick of not worrying about the file extension. Can I write a "csspostprocessor" for my theme that'll do the same but replace [[font:theme|name_of_theme]] with the correct full URL? And is there any documentation on how those csspostprocessors work?

I'm thinking that just "name_of_theme/etc." might work for the URL you actually output in the CSS, since Moodle collects all the CSS and serves it from theme/styles.php so you only need to get the relative path from there. I was doing "../theme" and that's probably and unnecessary step down and then up.

And after thinking about it, the javascript problem won't affect the stylesheets as unlike the header code the CSS won't be pulled into random PHP files in various directories but will always be called by theme/styles.php (or styles_debug.php) and so relative paths that work in one page, will work in all of them.
Just updating the code from Git to the latest developments from MOODLE_23_STABLE every week or so. After you do it, Moodle notices that something has changed and makes you go through the upgrade process where it checks your plugins etc.

And then you get that page that you've both screenshotted. I get the blank look when I do the actual update, but if I load the page I saved into my browser now, it looks fine since the CSS links are now returning the correct CSS.
So I just did an upgrade, and am still seeing this. I've saved the HTML that was delivered but reading over it nothing seems immediately odd.

However, it's pointing to a whole bunch of CSS style sheets (I've got it in theme designer mode so they're all separate links) and none of them work. Instead I get a polite message saying "css was not found, sorry."

As soon as I press "continue" on the upgrade screen, those same links start returning the expected CSS.

That give anyone any clues?

Looks like it must be this section of theme/styles_debug.php that's (temporarily) failing for me:

if (file_exists("$CFG->dirroot/theme/$themename/config.php")) {
    // exists
} else if (!empty($CFG->themedir) and file_exists("$CFG->themedir/$themename/config.php")) {
    // exists
} else {
    css_send_css_not_found();
}

// no gzip compression when debugging

$candidatesheet = "$CFG->cachedir/theme/$themename/designer.ser";

if (!file_exists($candidatesheet)) {
    css_send_css_not_found();
}

if (!$css = file_get_contents($candidatesheet)) {
    css_send_css_not_found();
}


I found your post while searching for info on how to do this. If you put the fonts directory inside your theme then try:

'../theme/name_of_your_theme/fonts/MyFontFile.ttf'

This seems to be at least half working for me. Though I seem to recall I tried something similar to link to a javascript file and there were some locations in Moodle that were one folder deeper than the rest, and in those areas it couldn't find my javascript.

I got around the javascript thing by using "new moodle_url('/theme/blah/blah/blah')" and for pictures generally you can use [[pix:theme|blah]] and it'll look in the pix folder inside your theme.

However, [[font:theme|MyFontFile.ttf]] doesn't seem to work, for me at least,

regards,

dave

PS (You might get better answers in the Themes discussion, perhaps someone will move your question there?)
Average of ratings: Useful (1)