General developer forum

 
 
Frank Ralf
Semantic DIV IDs?
Group Documentation writers
While trying out some theming in Moodle I stumbled across the fact that the <div> tag for the Site Administration block has a class of "block_admin_tree". My first thought was, that this should be an id instead, as there usually is only one such block per site.

<div id="inst2" class="block_admin_tree sideblock">

Then I had a lock at some Drupal code:

<div id="block-event-1" class="block block-event region-even even region-count-2 count-6">

The difference is, that the name of the block ("block-event") here is used both as a class and an id, with the id being the block name augmented with a number.

I think the way Drupal does it is a more semantical approach than using the id merely to count the number of blocks on a page as Moodle does. This makes it easier for designers to identify certain blocks.

I haven't found any documentation yet how this will be dealt with in Moodle 2.0.

Frank
 
Average of ratings: -
Tim at Lone Pine Koala Sanctuary
Re: Semantic DIV IDs?
Group DevelopersGroup Documentation writersGroup Particularly helpful Moodlers
My guess is that it won't change unless someone can do the necessary research to convince us that it won't break any existing themes.

The summary of the approach I am taking for Moodle 2.0 is that I am trying to change all the inner workings of themes, without actually changing the HTML generated by the standard theme very much. That is because

a) there is a limit to how much I can think about changing at one time, and

b) I want to keep things as backwards compatible as possible.

The only significant changes I plan to make are:
1. Try to get rid of the remaining tables for layout of blocks.
1. Clean up the inclusion of CSS and JavaScript (but that does not really count as improving the semantic HTML).
 
Average of ratings: -
Frank Ralf
Re: Semantic DIV IDs?
Group Documentation writers
Thanks for your reply, Tim. I'd be the first to admit that you have more than enough to do with implementing your proposed Theme engine for Moodle.

However, I think these are different aspects of theming that are of equal importance but I found the discussions on

"How hard is it to theme for Moodle?"
http://moodle.org/mod/forum/discuss.php?d=116398

and

"The Future of Moodle Templates?"
http://moodle.org/mod/forum/discuss.php?d=108993

a bit biased towards the more technical aspect of whether Moodle needs a template engine or not.

IMO a template engine is something for "hard core" themers to play with, whereas a system of well-thougt-out (semantic) ids and classes (and as less as possible extra div/span tags) helps the more "casual" themer to modify themes (see "Table Layouts vs. Div Layouts: From Hell to… Hell?" http://moodle.org/mod/forum/discuss.php?d=121217).

I'd like to hear some more opinions on this topic from the theming and usability experts.

I plan to write more elaborately on this topic in my (brand new) blog (http://moodle.org/blog/index.php?userid=728638). So stay tuned wink

Cheers,
Frank

 
Average of ratings: -
Frank Ralf
Moodle: On to more semantic HTML
Group Documentation writers
For those interested, these are the first parts of an ongoing work in progress:

1) Site Admin Block: "Look Ma, (nearly) no DIVs!"
User:Frank_Ralf/Moodle_HTML

2) Site Admin Block: Better image placement
User:Frank_Ralf/Semantic_HTML2

3) Course Categories - The Ugly Duckling
User:Frank_Ralf/Semantic_HTML3

Any feedback welcome!
Frank
 
Average of ratings: -
Goatee
Re: Semantic DIV IDs?
Group Developers
Hey Tim,

Since the instance number currently being used by the sideblock div ID is based on the installation, the only themes that would break are those that use the id to style a specific block. Since there are no core or third-party themes that use these ids, I assume that the owner/maintainer of the installation made the CSS change to alter the look of the specific block. Therefore, changing it to Frank's more semantic code won't be much of a theming issue since that person can easily make the necessary change themself.

With that said, considering all of the other work going into 2.0, this seems low on the priority list.
 
Average of ratings: -
Tim at Lone Pine Koala Sanctuary
Re: Semantic DIV IDs?
Group DevelopersGroup Documentation writersGroup Particularly helpful Moodlers
That's pretty convincing. Can you file a bug in the tracker and make sure it gets assigned to me? Thanks.
 
Average of ratings: -