By bobtimms on
I need to customize selected pages in a D7 site so that the DOCTYPE is changed from the RDFa and the default styles/css from Drupal are removed/not loaded -- so html.tpl.php needs to be overridden. I've tried a number of ways all of which have failed. I was able to change the page.tpl.php to use a custom node type for this but I am stymied with html.tpl.php.Any suggestions appreciated.
Comments
What have you done so far?
What have you done so far? You should only need to copy html.tpl.php to your theme directory and clear the cache.
Contact me to contract me for D7 -> D10/11 migrations.
Sorry if I wasn't clear. I
Sorry if I wasn't clear. I need the custom html template only on certain nodes. I have been able to set a custom page template for 'page--type--lab.tpl,php' for nodes with content type 'lab'. I need something like an 'html--type--lab.tpl.php for these nodes. I know I can set up using each individual node as in 'html--node--16.tpl.php' but this doesn't make sense with 20 or so nodes for this content type.
Ahh I see what you mean. I've
Ahh I see what you mean. I've not tried this yet, so I don't have the answer. But did it not work with html--type--lab.tpl.php?
Contact me to contract me for D7 -> D10/11 migrations.
Try something like
Try something like this:
template.php:
Now copy http://api.drupal.org/api/drupal/modules--system--html.tpl.php/7/source code into html--lab.tpl.php file and modify it. Dont forget to clear cache.
--
twitter: @Iztok | company: Drupal Theming & Development Studio
Awesome! Thank you very much
Awesome! Thank you very much @Iztok. I had been trying to make it work using the array similar to:
I was able to make the above work for peachfluid_preprocess_page. You saved me much frustration. Thanks again!
Perfect!
This was really useful and worked perfectly
Thanks bobtimms!
How to set ['node']
How to set ['node'] properties for $variables['node']?
Thank you!
I cannot work
I try the last codes by bobtimms, I cannot work? I already change the theme name, and clear the cache, the codes "if (isset($variables['node'])) { " I try to Echo something, but no message out! what can I do?
Custom html.tpl.php
Include the following inside template.php!
Now you can create your html--your_content_type.tpl.php
Thanks it works for me
Thank you @xvendo your solution worked perfectly for me with Drupal 7.66 & PHP 7.2
Custom html.tpl.php by path
Thought this might help anyone trying to make custom html.tpl.php by using you path alias. Place this code in your template.php.
Thanks Victory17 for posting.
Thanks Victory17 for posting. Nice piece of code that solved the problem.
Hi, i tryed <?phpfunction
Hi,
i tryed
'd03' is the name of my theme. The path is /go and i named the file html__go,tpl.php.
Cleared the cache.
But is doesn't work...
Can anybody help me please?
Oh, i see. I think it's only
Oh, i see. I think it's only working for nodes.
Is there a way to get it working for a view?
Very helpful, but I had to make one change:
Thanks for that code.
I ran into a problem when I had a node named find-a-vet. The '-' character caused a problem, so I modified the above as follows
So, for my node, the template file required was html--find-a-vet.tpl.php.
Maybe it is bad practice to have a '-' in an alias, but I thought I would mention it just in case anyone else had the problem.
custom html.tpl.php
I have tried:
...nothing works. Very frustrating! Can anyone please help???
Did you clear your cache
Did you clear your cache after adding each of those?
Contact me to contract me for D7 -> D10/11 migrations.
Yes, I cleared the cache(s)
...ok, I have no idea why it suddenly worked. I had been doing the same thing over and over for days with no success, but it just worked out of the blue...very strange. This is the one that finally worked:
Here's a detailed explanation of the steps I went through to make it work:
http://drupal.org/node/1189732
works!
where to place and html and the html-node.tpl.php?
Wow - Themeless Nodes looks very useful!
( I am developing on Mac with Acquia Drupal installed; yup -clearing cache with drush after each change; Drupal 7.16)
I have a custom module that does one simple page_callback, like this:
$content = array(
'#markup' => '
';
return $content;
- As a drupal page, it renders but the default theme interferes and squidges stuff around.
- That same complex html runs perfectly when simply called to a browser as index.htm
I've tried overriding the default theme with a node.tpl.php and a page.tpl.php
OR is there a way to make Themeless Node work for full page rendering?
with much appreciation for your thoughst on this -
Override html.tpl.php for a custom module
I was reading this to see if I can override the html to remove the site's main theme for a section that I was asked to add. Is it possible to override the html.tpl.php for a custom module that has a set of pages