0

I have a site running in a subdir of my main site, like www.mysite.com/drupal.

I want to use a separate page.tpl.php file for my about page www.mysite.com/drupal/about.

I have tried naming the file page--about.tpl.php and page--drupal--about.tpl.php but neither is working. It just loads the regular page.tpl.php file.

This seems really straightforward and one of those should be correct. Is this buggy because Drupal is in a subdir or am I doing something wrong?

(And yes, I've cleared the cache.)

1 Answer 1

2

have you seen through your theme suggestions for the about page?

If not, then please refer to it and create a tpl file according to the suggestions and you will see that particular template running for "about" page.

As of Drupal 7.33, Drupal core has a theme debug mode that can be enabled and disabled via the theme_debug variable. Theme debug mode can be used to see possible template suggestions and the locations of template files right in your HTML markup (as HTML comments).

To enable it, add this line to your settings.php:

$conf['theme_debug'] = TRUE;

OR, You can enable it with drush using:

drush vset theme_debug 1

And disable using

drush vset theme_debug 0

Note: You'll then see output like this when you inspect or view source:

<!-- THEME DEBUG -->
<!-- CALL: theme('page') -->
<!-- FILE NAME SUGGESTIONS:
   * page--front.tpl.php
   * page--node.tpl.php
   x page.tpl.php
-->
<!-- BEGIN OUTPUT from 'modules/system/page.tpl.php' -->
…
<!-- END OUTPUT from 'modules/system/page.tpl.php' -->
6
  • This is a custom theme I'm making so no built in suggestions. I enabled theme_debug which did output some additional info but no references to any tpl.php files at all. Commented Dec 27, 2016 at 4:18
  • hmm... I enabled theme_debug in settings.php and cleared the caches but i'm not seeing any of that markup in the page source. Commented Dec 27, 2016 at 4:55
  • This is in Drupal 7.52 so it should be working. (theme_debug was already in the settings file, i just had to uncomment it.) Commented Dec 27, 2016 at 5:05
  • On which page are you inspecting the page source? Suggestions will be visible to you on about page. i am not sure why you are not able to see it. Commented Dec 27, 2016 at 5:33
  • I am looking at the about page, though I assume any page should be offering some suggestions once theme_debug is enabled. It doesn't appear on any pages. Commented Dec 27, 2016 at 19:14

Your Answer

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

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