Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
This is a followup issue to http://drupal.org/node/469242 as that issue was already 2 pages long.
Comments
Comment #1
mcrittenden CreditAttribution: mcrittenden commentedSub. Webchick just moved #522006: Conditional Styles in .info files, since drupal_add_css has it back to D8 so we'll need to document the correct way to add conditional styles in this new system, which will most likely involve overriding html.tpl.php, correct?
Comment #2
alexanderpas CreditAttribution: alexanderpas commentedAdding them during the preprocess stage is another method. (template.php)
for example, garland does it like this:
Comment #3
alexanderpas CreditAttribution: alexanderpas commentednice usecase from a themer here:
documenting this is important (and ofcourse knowing how too ;) i guess it's another case of
template_preprocess_html()
)Comment #4
Anonymous (not verified) CreditAttribution: Anonymous commentedthanks for reposting this here alexanderpas.
Another very similar user case scenario, I want a body class "with-primary" and "with-secondary" if main menu or secondary menu are displayed in the page. It actually comes from using the ZEN layout technic, that is used also in Basic. As the primary links are loaded after the content, you need to add margin to the top of the content, but if there is no menu, to remove the margins.
As I mentioned in the other thread : "I know you could wrap your content into an extra
<div>
with the page classes, but what if I actually don't want to, because I don't want to add markup where I don't need to ? It feels like Drupal would force me to have extra markup, and IMHO, this is not a good thing."Comment #5
NaheemSays CreditAttribution: NaheemSays commented@couzinhub - two things:
1. From what I understand, the two new regions of page_top and page_bottom are supposed to be full browser width, so if the body tag has something limiting it's width, the blocks in them regions will need to make sure they have additional markup to make sure (but they generally will have that markup anyway)
2. You are still allowed to edit html.tpl.php, so if you don't want to have extra markup you don't need to.
Comment #6
Anonymous (not verified) CreditAttribution: Anonymous commented@nbz
1 - not sure why you mention the regions width here, I didn't say anything related to this (?). I was only taking a css example that would require margins on specific conditions.
2 - Of course I can, but how do I use a page.tpl.php variable into html.tpl.php ? That's my real question. If possible, we should document how to do this.
Another example if you prefer, let's say I want the
<body>
to have aclass="with-footer"
when there is a block in thefooter
region. Before I could just add a condition intheme_preprocess_page
:But now, I can't access the footer within
theme_preprocess_html
as it is intheme_preprocess_page
... so I can put a conditionnal class to the<body>
and I have to apply it in an extra wrapper inpage.tpl.php
.SO basically, something very easy to do in D6 like adding body classes becomes impossible to do in D7... when so much have been done in order to make it more easy and flexible.
Any solution ?
Comment #7
alexanderpas CreditAttribution: alexanderpas commentedaccording to http://api.drupal.org/api/function/template_preprocess_html/7 this should work.
Comment #8
Anonymous (not verified) CreditAttribution: Anonymous commentedTested. This works for regions. That a very good news, it seams like all the regions are present and usable there.
I had a closer look at the
$vars
from html. The only missing element that still bothers me is the navigation. Going back to my first message, I can't check if there's navigation or not on the page.Not a big deal, just wanted to mention this.
Thanks for your help !
Comment #9
whatdoesitwant CreditAttribution: whatdoesitwant commentedJust subscribing.
Comment #10
jhodgdonSomeone filed a separate issue stating:
At http://drupal.org/update/theme/6/7#rdfa_header is talk about changes in page.tpl.php while global structure of HTML document is now defined in html.tpl.php.
(I've closed that seprate issue as a duplicate of this one, since it looks as though doc follow-ups to #469242: Move <head> outside page.tpl.php are supposed to be filed here.)
Also, it looks like the theme update guide doesn't yet mention this (rather major) change to page.tpl.php -> html.tpl.php at all. It should.
Comment #11
jhodgdonComment #12
catch#653068: Update documentation is incomplete
Comment #13
jhodgdonMoving to the Theme System queue for follow-up, since this is (as I understand it) a request to get the update from that other issue documented on the module/theme update guides, and not a request for better documentation for api.drupal.org
The "Needs Documentation" tag should stay, which is how we're grouping issues having to do with update docs.
Comment #14
JohnAlbinRe: comment #3
To be honest, I'm not sure how to get changes to html.tpl.php's $classes var if you want to base those changes on something that happens in page.tpl.php. That was one of my arguments against the split originally.
And I haven't played around with that particular issue to say how to do it. If anyone has any code snippets to share, I'd love to see them.
Comment #15
laura s CreditAttribution: laura s commentedFollowing up on this, I propose the following:
Revise and possibly split item #4 on http://drupal.org/update/theme/6/7:
If this seems reasonable (and it does to me), next step is drafting the actual change so it's clear and doesn't need to be revisited. I hope to get to that today and will follow up on this issue with proposed language changes.
Comment #16
sillygwailoBumping this up.
Here's a first stab at documenting the newly available html.tpl.php.
Comment #17
jhodgdontagging for theme update guide
Comment #18
jhodgdonI just added a section pretty much like #16 (thanks!) to http://drupal.org/update/themes/6/7#html-tpl -- so at least we now have a section explaining the existence of html.tpl.php. This is also item #2 of comment #15.
It looks like someone else already took care of item #1 of comment #15.
So the remaining need is item #3 of comment #15:
So, leaving this issue as "active" until that is done (and changing title).
Comment #19
jhodgdonI've gone through the theme update guide and I think it's all clear with respect to html.tpl.php vs. page.tpl.php now. The only section I updated was
http://drupal.org/update/themes/6/7#closure
(the section mentioned in the previous comment).
So I think this issue is finally fixed.