Why is my specific tpl.php page not being used?

I cannot use unique page--xxxxxxx.tpl.php

for a specific page.

I created the content of the page, filled it in and gave it a path alias. Let's say: " mypage/mycontent

". Then I created a file page--mypage--mycontent.tpl.php

at the root of my theme. Mine is used instead page.tpl.php

.

I was under the impression that Drupal 7 automatically searches for template suggestions using the format page--path.tpl.php

, is that wrong? Do I need to include specific code in my template.php file first? I tried clearing the theme cache by the way and it had no effect.

+3


source to share


2 answers


If it's just a node, try renaming the template file to page - node - NID.tpl.php and then clear the cache, also remember to replace the NID with the nid of that node as something like page - node - 11.tpl.php :)



Hope it works ... Muhammad

+2


source


Your impression is correct, and page--mypage--mycontent.tpl.php

(ie the one you have already tried) is the correct file name that will be used to override page.tpl.php

for the page with the specified path " mypage/mycontent

". You don't need to change anything.



However, in addition to clearing the Drupal cache, you also need to clear the browser cache. In most browsers, including Firefox and MSIE, you do this by holding down the SHIFT key while reloading the page. Without clearing the browser cache, you won't be able to view the template suggestion in the browser.

+1


source







All Articles