0

I am developing a subtheme of a Zen-based subtheme. I have created a page--front.tpl.php template but it isn't being recognized. All I see is the page.tpl.php template being used for the front page.

I have cleared the cache multiple times, looked for any other page--front.tpl.php files in the subtheme I am basing mine off of (there are none). I have restarted apache to make sure nothing is being cached, so I am at a loss as to why this is not working. I am using Drupal 7 on a linux server.

Any ideas as to what may be causing this issue? I have googled similar problems but most had to do with clearing the cache (which I have already done).

Using Theme developer, it shows that page--front.tpl.php is not a canditate template to use. In fact it doesn't show any candidate templates that could be used while on the front page of the site.

Thanks.

6
  • Are you sure that your file name is page--front.tpl (without .php) ? The extention of the file (.php) should be excluded from filename. Similar question here.
    – Jack-PL
    Sep 16, 2013 at 20:18
  • That is for Windows based servers I believe. With unix based ones you don't drop the php extension. I have tried it without the .php extension as a lark but it didn't make any difference.
    – user5013
    Sep 16, 2013 at 21:13
  • permissions? make sure your webserver can read it, eg, you didn't create it owned by another/your user id and it's not readable to the rest of the world.
    – Jimajamma
    Sep 17, 2013 at 0:18
  • See template.php in your theme maybe some function do reordering this page
    – user17890
    Sep 17, 2013 at 12:22
  • 1
    check if the original template "page.tpl.php" is also in the same directory template suggestions do not work in subtheme folder
    – pico34
    Sep 17, 2013 at 12:24

1 Answer 1

1

Found out the problem was caused by the Context Layout module. Apparently this module overrides Drupal's normal template file search order. The solution was to either to disable the Context Layout module or include the templates (like page--front.tpl.php) in the layouts definition in the themename.info file. I went with the latter solution.

Here is an example of what should appear in the .info file:

; Layout: Landing 
layouts[landing][name] = "Landing Page"
layouts[landing][description] = "A layout for landing pages."
layouts[landing][template] = "templates/page--front"
layouts[landing][regions][] = "search"
layouts[landing][regions][] = "highlighted"
layouts[landing][regions][] = "mega_menu"
layouts[landing][regions][] = "slider"
layouts[landing][regions][] = "sidebar_first"
layouts[landing][regions][] = "sidebar_second"
layouts[landing][regions][] = "footer"
layouts[landing][regions][] = "bottom"

Notice the layouts[landing][template] line where we define where and what template file to use. This is key to getting this to work with Context Layouts.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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