how do I create custom layout for content-type page

Ton Haarmans
Hi, I would like to create a custom layout for a custom content-type, for instance the content type 'klantpagina'. In 'normal' Drupal I would add a function to template.php like this: function platon_preprocess_page(&$variables, $hook) { $alias = drupal_get_path_alias($_GET['q']); if ($alias != $_GET['q']) { $template_filename = 'page'; //Break it down for each piece of the alias path foreach (explode('/', $alias) as $path_part) { // Added the str_replace becayse path parts with - were not being picked up properly by the theme_hook_suggestions $template_filename = $template_filename . '' . str_replace("-", "_", $path_part); $variables['theme_hook_suggestions'][] = $template_filename; } } if (isset($variables['node'])) { $variables['theme_hook_suggestions'][] = 'page__type'. $variables['node']->type; $variables['theme_hook_suggestions'][] = "page__node__" . $variables['node']->nid; } } how would I do this in Opigno? BTW, I am NOT a PHP-programmer, I just used this piece of code I found somewhere...
Profile picture for user James Aparicio
James Aparicio

Hi Ton,

Hi Ton, If you want to just change the interior part of page (the info that is in the content type ),  the only thing you have to do is to add a template  named node-[type].tpl.php in your theme templates folder. https://www.drupal.org/node/17565 If you want to display a diferent complete page you do something like you wrote. The opigno theme (platon) only has 1 page template, (page.tpl.php) so if that code is working,  you just have to add a name corresponding to that naming suggestion in the code. There is the html template, then the page template, and then the node template. There is nothing different from Opigno to drupal in that regard. I suggest you take a look at a guide like:http://themery.com/dgd7/theming/templates/corehttp://themery.com/dgd7  Dont forget to clear the cahe each new hook/file you add, otherwise it will not be recongnized until you do.