In themes it would be great if the <html>, <head>, and <body> tags were brought back for the page.tpl.php file as they were in Drupal 6. This would make theme development easier for some tasks such as inserting styles and scripts into the <head> tag, or adding markup/code to or before the <html> tag.

Thank you for reading and responding,
AaronMcHale

Comments

droplet’s picture

Version: 8.x-dev » 7.x-dev
Category: feature » support

copy html.tpl.php under system module to your theme

aaronmchale’s picture

Yes, hmm, I never noticed that file probably because none of the core themes contain that file.

Would that then suggest that the core themes should contain this file?

AaronMcHale

droplet’s picture

Core don't duplicate same file into theme

aaronmchale’s picture

Well, there needs to be some hint there.

AaronMcHale

Everett Zufelt’s picture

Status: Active » Fixed

You are right, templates aren't super easy to discover. But, they are meant for developers / themers, not ed users.

A quick Google search found me http://drupal.org/node/190815

aaronmchale’s picture

Yeah, that document is quite useful.

Here is an idea, adding a comment to the top of the page.tpl.php file for core themes explaining that there is a html.tpl.php file for customising the , , and tags.

AaronMcHale

Everett Zufelt’s picture

Title: Bring Back <html>, <head>, <body> Tags » Document existence of html.tpl.php in page.tpl.php
Version: 7.x-dev » 8.x-dev
Component: theme system » markup
Category: support » feature
Status: Fixed » Active

I don't really think this is necessary, but it is worth discussion.

Feature request to add a comment to the top of the page.tpl.php file for core themes explaining that there is a html.tpl.php file for customizing the <html>, <head>, and <body> tags.

aaronmchale’s picture

Cool, I would write a small patch, however I'm not sure how to write patches.

AaronMcHale

Everett Zufelt’s picture

@AaronMcHale

Well, the first step is for more people to weigh in on whether this is a good idea or not.

webchick’s picture

Component: markup » documentation
Issue tags: +Novice, +Needs backport to D7

I think it's a good idea. It's definitely not super intuitive.

Probably just involves adding another @see directive at the bottom of the docblock, since that's both the standard way to refer to things, and also just above the spot where you'd be going "Wait. Div? What the heck?"

This should both be fairly simple to do and should be backportable to D7. Tagging.

Aaron: See http://drupal.org/patch for info on how to write patches. Feel free to stop by #drupal-contribute anytime as well if you need more "real-time" help. :)

aaronmchale’s picture

Sounds good.

Thanks for the link :)

AaronMcHale

droplet’s picture

don't miss region.tpl :)

mallezie’s picture

Status: Active » Needs review
StatusFileSize
new811 bytes

added @see at end of docblock to html.tpl.php in page.tpl.php and small comment
added @see in region.tpl.php

i'm not sure if this is exactly what's needed. But gave it a try.

sven.lauer’s picture

Status: Needs review » Needs work

The patch also adds

-
+  <!-- start of $page inside html.tpl.php-->

This should be removed.

Also, I am not sure that region.tpl.php really needs a reference to html.tpl.php---The name page.tpl.php can be misleading in that it may suggest that the whole (HTML) page is rendered by this template.

mallezie’s picture

Status: Needs work » Needs review
StatusFileSize
new335 bytes

Rerolled with only @see addition in page.tpl.php

I'm also not sure if region.tpl.php needs an @see, but implemented droplet's suggestion.

droplet’s picture

@mallezie,

Thanks for your works. I was thought region.tpl.php included in page.tpl.php
(or documented to see modules/system folder)

I think commented on system/page.tpl.php is meaningless. The real problem is when you are on bartik/page.tpl.php or any themes' files, you can't found the place to modify HEADER HTML. If we're at system folder, I guess you must open html.tpl.php and see what that is.

If it allowed, I would suggest move /core/modules/system theme templates to /theme/core/**. Or add an empty folder with README refering themer to system folder.

joachim’s picture

Status: Needs review » Needs work

> The real problem is when you are on bartik/page.tpl.php or any themes' files, you can't found the place to modify HEADER HTML.

Good point. Let's make this change in all of the core themes' page.tpl.php.

joachim’s picture

Issue summary: View changes

Updated issue summary.

rootwork’s picture

Assigned: Unassigned » rootwork

Working on this at the Drupalcon code sprint.

rootwork’s picture

StatusFileSize
new744 bytes

Well, it turned out Bartik was the only one that I could add this to.

  • The Seven theme files apparently have no Doxygen documentation. I assume that's for a reason, and didn't want to create it just for this fix. If it's not intentional, maybe there's a separate issue for it.
  • The Stark theme has no page.tpl.php.

So this patch just updates page.tpl.php in the system module (as before) and the Bartik theme.

rootwork’s picture

Status: Needs work » Needs review
StatusFileSize
new744 bytes

Oops. Fixing status.

jhodgdon’s picture

Seven theme files having no documentation - not intentional, not good, but let's not deal with it on this issue.

So... I'm wondering if this reference between page.tpl.php and html.tpl.php should be a bit more verbose than just saying "@see html.tpl.php"? Maybe something like a line saying
Note that the html.tpl.php file contains the HTML header.
or something to that effect? Which would need to go farther up in the file. Would that be clearer and easier to notice?

rootwork’s picture

I think that would make a lot of sense.

jhodgdon’s picture

Status: Needs review » Needs work

In that case... (status)

rootwork’s picture

Status: Needs work » Needs review
StatusFileSize
new1.28 KB

So it turns out, after all that, at the top of Bartik's page.tpl.php file, it says:

 * The doctype, html, head and body tags are not in this template. Instead they
 * can be found in the html.tpl.php template normally located in the
 * modules/system folder.

With the new @see at the bottom (where, as webchick mentioned in #10, people might be looking) and that comment at the top, that seems sufficient, unless we really feel like we should move that comment from the top to the bottom. (My thinking is that people might skip over it, visually intuiting that it's part of the "Available variables" section which takes up most of the documentation.)

So, this rerolled patch:

  • changes the reference in Bartik to "core/modules/system"
  • adds a similar comment to the top of core/modules/system/page.tpl.php, except it says "...html.tpl.php template in this folder."
jhodgdon’s picture

Aha! I don't think either of them should refer to "folder", since I think we normally use the term "directory", but I think this solution is good -- text at the top where it belongs, and @see at the bottom where it belongs.

rootwork’s picture

StatusFileSize
new1.29 KB

Cool. Changed "folder" to "directory."

jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me. Tentatively setting to RTBC; if no objections I'll get it committed soon. Thanks!

Tor Arne Thune’s picture

Looks good to me. Good thinking on adding this comment in page.tpl.php. I remember I was searching for the template containing head long ago, not having found it in page.tpl.php.

jhodgdon’s picture

Version: 8.x-dev » 7.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

Committed to 8.x. Needs slight rework for 7.x, since the directories there do not have core/ on them.

kgoel’s picture

Assigned: rootwork » kgoel
kgoel’s picture

Assigned: kgoel » Unassigned

Sorry, didn't realize it was assigned to rootwork.

kgoel’s picture

Assigned: Unassigned » kgoel

Assigning back to myself for backport.

kgoel’s picture

StatusFileSize
new1.25 KB

simple D7 patch.

kgoel’s picture

Status: Patch (to be ported) » Needs review
rootwork’s picture

Status: Needs review » Needs work
+++ b/themes/bartik/templates/page.tpl.php
@@ -6,7 +6,7 @@
- * modules/system folder.
+ * core/modules/system directory.

If this is a D7 patch, then this comment -- while accurate in D8 -- should read (as it did before) "modules/system" and not "core/modules/system," as noted in #29.

kgoel’s picture

Status: Needs work » Needs review
StatusFileSize
new1.24 KB

@rootwork - good catch. Updated D7 patch.

rootwork’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me! Others can review if they want, but it's a pretty simple patch...

Thanks kgoel!

jhodgdon’s picture

Status: Reviewed & tested by the community » Fixed

Committed to 7.x. Thanks!

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Corrected typo.