Problem with modified theme.

Problem with modified theme.

by Dave Cuttriss -
Number of replies: 6
I created a new theme from Standard white for a customer's site & meticulously went through all the style sheets and changed body
background-color: to #00603A; (OK plus a lot of other stuff)

Everything is fine except that out of 24 courses 3 are showing a body background of #FFFFFF (discernable in the odd "space" between other styles such as header or navbar which also have
background-color: #00603A)

Using Firebug on a "Bad" page I can see
<body id="course-view" class="course course-52 editing dir-ltr lang-en_utf8"> has the following styles associated:

body {
background-color:#FFFFFF;
font-family:Trebuchet MS,Verdana,Arial,Helvetica,sans-serif;

}

view.php?id=52 (line 338)

body
{
background-color:#00603A;
margin:5px;
body, td, li {
background-color:#00603A;
font-family:Arial,Helvetica,sans-serif;
font-size:13px;

}

styles.php (line 688)
body {
background-color:#00603A;

}

styles.php (line 254)
body {
background-color:#00603A;
color:#FFCE00;
margin:5px;

However on a good page Firebug shows:

<body id="course-view" class="course course-30 editing dir-ltr lang-en_utf8">

body {
background-color:#00603A;
margin:5px;
}
styles.php (line 694)
body, td, li {
background-color:#00603A;
font-family:Arial,Helvetica,sans-serif;
font-size:13px;
}
styles.php (line 688)
body {
background-color:#00603A;
}
styles.php (line 254)
body {
background-color:#00603A;
color:#FFCE00;
margin:5px;
}

Which is what I want.

If I create a new blank course it is OK. If I then import a "bad" course into the new course then the white body somehow also gets imported into the new "good" course.

I have done an in depth search on the entire directory for

body {
background-color:#FFFFFF;

& cannot find an entry anywhere!!

Web Developer reports.....

<<http://www.daltraining.eu/moodle/course/view.php?id=52

Embedded Styles from http://www.daltraining.eu/moodle/course/view.php?id=52

body { background-color: #ffffff; font-family: Trebuchet MS,Verdana,Arial,Helvetica,sans-serif; }td { border: 1px dotted gray; } body { direction: ltr; }
>>
There are no other instances in the CSS apart from this.

Why should one course be OK & another not? I would assume they are using exactly the same code generation files?

Can any one point me in the right direction to resolve this. I can't put up the URL as it's a closed and commercially sensitive site.

Thanks from a bemused

Dave

Average of ratings: -
In reply to Dave Cuttriss

Re: Problem with modified theme.

by Frank Ralf -
Hi Dave,

There are two possible solutions:

1) Use !important on the body element:

body {
background-color:#00603A !important;
}

2) Set the background-color on the html element:

html {
background-color:#00603A;
}

or even combining the two:

html {
background-color:#00603A !important;
}

That should do the trick.

hth
Frank


In reply to Dave Cuttriss

Re: Problem with modified theme.

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers
Could it be that whoever created these three 'rogue' courses, that the option to select a different theme was set? I have read that one can do this, but have not got round to testing it yet.

Just a thought in passing.

In reply to Mary Evans

Re: Problem with modified theme.

by Dave Cuttriss -
Thanks both...I'll try out the suggestions.

But...any suggestions as to why the body tag is embedded (

Embedded Styles from http://www.daltraining.eu/moodle/course/view.php?id=52

body { background-color: #ffffff; font-family: Trebuchet MS,Verdana,Arial,Helvetica,sans-serif; }td { border: 1px dotted gray; } body { direction: ltr; })

in view.php for a "bad" page and isn't in a "good" page. Where is view.php picking this up from & why "embedded" (I don't know, I've looked at view.php & can't see anything except the standard theme files I would expect sad) Trouble is my knowlegde is little enough to be dangerous......


Dave


In reply to Dave Cuttriss

Re: Problem with modified theme.

by Dave Cuttriss -
Frank: your suggestions worked like a dream. Many thanks...I'd still like to know though where view.php is picking this up from though as it's still "embedded" although !important is over riding it........

Cheers & thanks again both for your help, really appreciated.

Dave
In reply to Dave Cuttriss

Re: Problem with modified theme.

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers
Hi Dave,

Glad you managed to 'fix' the bug!

In an earlier post I made to this forum READ HERE I too got quite frustrated with a similar situation with embedded styles. I was directed to report my findings as a BUG, since...

"...Inline styles are a hang-over from the bad old days. They are now against the coding guidelines and should be considered a bug. Indeed, if you find a specific instance, feel free to file it as a bug at http://tracker.moodle.org/. We are gradually getting rid of them all..." Tim Hunt - Open University

Hope this helps.

Mary