D
D
Dmitry Baskakov2020-07-29 05:51:03
Drupal
Dmitry Baskakov, 2020-07-29 05:51:03

How to define your page layout in required nid in Drupal 7?

It is necessary for a contact page that has its own nid to define a unique template. How to do it?

I wrote this in template.php in the [THEMENAME]_preprocess_page function:

if (isset($vars['node']) && isset($vars['node']->nid)) {
    $vars['theme_hook_suggestions'][] = 'page__nid--' . $vars['node']->nid;
}

[THEMENAME] - here is the name of my theme

Plus files were created: page__node__5134.tpl.php, page__node--5134.tpl.php, page__nid--5134.tpl.php, but none of them worked. The files are contained in templates/pages at the root of the theme

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sHARek, 2020-07-29
@dmitrybascacov

node--[type|nodeid].tpl.php ?
page--[front|internal/path].tpl.php ?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question