Closed (fixed)
Project:
Drupal core
Version:
7.x-dev
Component:
Bartik theme
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
15 Jun 2010 at 01:43 UTC
Updated:
24 Jun 2011 at 02:58 UTC
Jump to comment: Most recent file
Comments
Comment #1
jacineComment #2
Jeff Burnz commented+1, thinking for consistency this should be rolled out to all regions, sidebars have wrappers also and we have this rather redundant "section" wrapper on nearly everything (clearly header and footer need a constraining DIV). Other than that most regions and other page output have triple wrappers which at a glance could be done with one.
Comment #3
jensimmons commentedSo stuff like this:
<div id="featured" class="region"><div class="section clearfix">is in Bartik because that's how it's written in the core files.
div id
followed by
div class section
replaces
div id
followed by
div example-inner class
that's all over D6. In Zen, in other many themes too.
Why does Drupal provide 2 divs, nested inside of each other by default — because of IE, and it's inability to understand the CSS boxmodel properly. Having 2 divs like this let's people easily write much better CSS.
I like the way the 2 nested divs have been renamed, so I used the new convention. (And even if I didn't like it, I'd use it anyway to be consistent and Druply.)
It might be true that it's not as needed anymore. New techniques have come along. IE 8 is better than IE6... but I hesitate to remove them because: it's the Drupal way to have them, and frequently they are still needed.
[I know there is not CSS in Baritk using these (or using most of them.) But Bartik has been created to be flexible for people who are using it as a base theme. I know people should use other themes as a base theme... I know Bartik is not going to be all things to all people, but I still feel passionately that Bartik should work for any front-end developer who is new to Drupal and uses Bartik as the base for their first custom Drupal site. Because that's what everyone does.]
So, back to the main thing at hand.... do we take these out.
Comment #4
jacineWho is talking about a base theme? I'm not. I am and have been totally on board with your thinking on how it should be easier for people to front-end devs use. This is something I have spent a lot of my personal time working towards in this community, so I'm not sure why you are responding defensively with this here... I'm saying the way it is right now is not ideal and is potentially confusing. As a front-end developer that has been theming Drupal sites for about 4 years, when I realized these duplicate classes were there, it confused me for a good 10 minutes.
Here's an example of what I'm talking about:
Before:
Each region has 2 .region and 2 .section classes being applied to it. That makes no sense.
Proposed After:
Still plenty of divs... I'm not talking about removing inner divs that are needed for box model stuff. There are more than 2 nested DIV's when the code in region.tpl.php is combined with what is in page.tpl.php. If you want to keep 3 nested DIV's that's your decision, but at least get rid of nested region and the odd sitemap classes...
The Drupal way, is that themes are allowed to do what they want with their markup... If you want to keep the .section div inside each region, that's your choice, but I think it should be done in region.tpl.php. ID's can be added very easily, and even the code comments if you wanted them. IMO this is easier for newbies to understand. If you don't want to go that route, then you could also just print the region content itself in region.tpl.php and put all the wrappers in page.tpl.php. It's the fact that 1/2 the region code is printing in page.tpl.php and the other 1/2 that is printing in region.tpl.php is providing some of the same classes that is a problem.
Hopefully I am making sense and you just misunderstood?
BTW, Zen is using the region template files and is not giving regions multiple nested .region and .section classes.
Comment #5
Jeff Burnz commentedOne of the aims I believe of the region wrapper and new $classes variables is bring more consistency to Drupals markup. I think if there's any drive towards a "Drupal way" its to remove markup from page.tpl.php and abstract it to the other templates - most notably region and block templates, so page.tpl.php only includes very basic markup, with all the design hooks going into the nested templates.
I think this is conceptually right in the new paradigm of Drupal templates - region.tpl.php has suggestions and we can use those to good effect. I see this is how Zen has approached it in D7 and I agree very much with this approach (with its region--sidebar.tpl.php).
On a more personal level I like lean efficient markup - I think its good for the web, good for the website - every single page speed tester tells you to remove unneccessary DOM elements - why? Because pages load faster, render faster, execute JS faster and so on - especially for low power, low bandwidth devices (mobile web).
http://developer.yahoo.com/performance/rules.html#min_dom
Comment #6
jensimmons commentedOh, I wrote this up the other day on the bus, and never submitted it:
Yeah, sorry if I came across defense. That was dumb of me. No one in this queue has sad anything besides awesome things.
And mostly, I wasn't sure at all about it. About if there are too many divs. LOL. I'm sitting here laughing at any idea that I'm saying "we need those divs! They are the Drupal way, so let's have tons of divs."
Uh, did I say that. :(
Thanks for writing out the code — it's easy to see there what you mean. Yeah, that's way too many divs. Let's clean it up just like you suggest. I'll take a deeper look once I'm back in NYC.
Comment #7
jensimmons commentedComment #9
Jeff Burnz commentedre-roll
Comment #10
Jeff Burnz commentedrelates to #883408: Remove redundant section classes and wrapper divs from bartik
Comment #11
dries commentedLooks much cleaner to me, and I'm not even a designer. Would be good to get sign-off from another designer.
Comment #12
tim.plunkettMuch cleaner and simpler, and less confusing. Awesome!
Comment #13
jacineYay, Thank you Jeff! You rock. :D
Just one nit-pick...
Can we check if the region is populated before printing these comments, or even cleaner - move them to region.tpl.php?
Powered by Dreditor.
Comment #14
Jeff Burnz commentedMaybe we just don't need those comments, looking at the reset of page.tpl.php it seems it would be more consistent to not have them.
Comment #15
jacineThat's fine with me. I think this is RTBC, but I'll wait a few in case anyone else has any thoughts on this... :)
Comment #16
Bojhan commentedOk, RTBC then - we have waited a few :)
Comment #17
bleen commented*much* more gooder
RTBC++
Comment #18
dries commentedCommitted to CVS HEAD. Thanks.
Comment #20
Tjarco commentedDear Jeff & others,
I'm really new to Drupal, started today with creating a site with the bartik theme.
The tryptich normally contains 3 regions (first, middle & last) i want to customize this into one region
is this possible with the bartik-nested-region-classes_3.patch?
any help on how to implement would be welcome,
I would have started, downloading the mentioned CSS files and manually changing the codes as provided
will this result in just one tryptich region?
many thanks in advance!
Tjarco
Drupal & Scripting N00b
Comment #21
bleen commentedTjarco - welcome ...
first, I suggest that you simply dont use "middle" and "last" .... if your just playing (to learn your way around) then you can easily make the tryptic region into one region by simply editing the css. If you are planning on using bartik for a real site, then I suggest you create a "subtheme" (google "drupal subtheme for tons of docs) in order to slightly modify Bartik
Second, you shouldnt change the various meta data fields on an issue like this (especially the "assigned" field) unless you have good reason pertaining to the nature of the issue.
In this case you probably would have been better off opening a new support ticket. Also, as you are a beginner I HIGHLY recommend going to the drupal channels on IRC (http://drupal.org/irc) for questions.