Associare tpl a tipo contenuto

3 contenuti / 0 new
Ultimo contenuto
Associare tpl a tipo contenuto

Sto usando Adaptive Theme con Corolla.
Ho creato un tipo di contenuto chiamato: esempio
Ora vorrei che tutte le pagina /esempio* abbiano una loro particolare struttura (senza logo ed header, senza spazio centrale dei contenuti) per questo motivo ho duplicato page.tpl.php e rinominato esempio.tpl.php
Come faccio ad associare esempio.tpl.php al tipo di contenuto esempio?

Drupal Version:

Ciao,
in genere per fare questo io metto mano template.php faccio in 2 modi.

Se carico il tpl in base al content type:

<?php
funciton mytheme_preprocess_page
(&$variables) {
  if (isset(
$variables['node'])) {
   
$node = $variables['node'];
    if (
$node->type == 'esempio') {
     
$variables['theme_hook_suggestions'][] = 'page__type__esempio';
    }
  }
}
?>

E il file dovrà chiamarsi page--type--esempio.tpl.php

Se carico il tpl in base all'url:

<?php
funciton mytheme_preprocess_page
(&$variables) {
  if  (
drupal_match_path($_GET['q'], 'esempio*')) {
   
$variables['theme_hook_suggestions'][] = 'page__esempio';
  }
}
?>

E il file dovrà chiamarsi page--esempio.tpl.php

Ciao
Ioris

ok. Grazie
In effetti sbagliavo a dare il nome al file che deve essere page--type--esempio.tpl.php e non esempio.tpl.php