1

My website uses i8ln and it is configured to work with a large amount of languages. Using the page.tpl.php i managed to translate the website. But i had to create another custom theme for a specific path and the 404 page. So i created a page--node--23.tpl.php file and clear the cache. The file worked since the node i was trying to import the new theme was the node id defined when i created node/23. Now my problem is that i need to translate node/23 but when i click on translate and click save to save the translation another node is created and hence the page--node--23.tpl.php file is not used. How to set up drupal and able to adjust trasnaltion along with the custom themes???

  • Is it not possible to make use of node tpl and to theme you can throw in some conditions that checks for the specific paths. – GoodSp33d Jul 5 '12 at 14:19
  • Can you explain what do you mean?? – paranod Jul 9 '12 at 8:11
  • Instead of adding node-NUMBER.tpl make use of node.tpl.php(which will be used for all nodes) and add some conditions over there which will check for specific paths and theme accordingly. – GoodSp33d Jul 9 '12 at 8:33
1

Theming pages based on node id is not the way to handle this because you will have to copy each template to the corresponding translated nids.
A better approach is to create content types based on differences (which can be different layouts as well).
You can create a content type "404_page" for 404 pages in each language and create a template node--404_page.tpl.php to style them. This is all node specific.

There are also page specific overrides like:

page--front.tpl.php
page--user.tpl.php
page--blog.tpl.php

Edit: Some extra information on Theme hook suggestions can be found on the Drupal 7 Theme Hook Suggestions documentation page.

  • So i have created the new content type called 404_page and created a page using that type. Also i created the node--404_page.tpl.php file and when i view the page i still got the header and footer of the main pages. Using Firebug the body class is defined with: html not-front logged-in no-sidebars page-node page-node- page-node-893 node-type-404-page lang-en toolbar toolbar-drawer il8n-en show-grid ... Anyhow in my node--404_page.tpl.php file i have just only added the below code: – paranod Jul 9 '12 at 7:04
  • <div id="page" class="container_24 clearfix"> <div id="layout" > <div id="main-layout"> <?php print render($page['content']); ?> </div> </div> </div>'code' So why i am i stil getting the heater and footer? – paranod Jul 9 '12 at 7:04
  • That's because the header and the footer is rendered from the page.tpl.php template. Maybe you can unset the $header and $footer in the hook_preprocess_page($vars) if the $content contains a node of type 404_page. – JurgenR Jul 9 '12 at 7:21
  • You can check template files and preprocess functions using the drupal.org/project/devel_themer module. – JurgenR Jul 9 '12 at 7:24
  • I have read about unsetting css files but not how to unset regions. How am i going to accomplish that? – paranod Jul 9 '12 at 7:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.