Download & Extend

using theme_hook_suggestions in preprocess_page function.

Project:Basic
Version:7.x-3.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed (fixed)
Issue tags:override page options, template file

Issue Summary

Hi,

i'd like to know if there is any reason about the no usage of theme_hook_suggestions in the preprocess_page function.

In the 6.x versions, the theme offers the ability to override the page.tpl.php file with node type support, and it seems easy to reproduce that on the 7.x versions with the theme_hook_suggestions system.

what about code below :

<?php
function basic_preprocess_page(&$vars, $hook) {
// content of the function
 
if (isset($vars['node']) && $vars['node'] -> type != "") {
   
$vars['theme_hook_suggestions'][] = 'page__type__' . $vars['node'] -> type;
  }
// end of the function
?>

Comments

#1

Try process instead of preprocess:

<?php
function THEMENAME_process_page(&$vars, $hook) {
....
  }
?>

#2

Hi

Thanks for answer.

Actually the code i mention above works. Why do you think it is better to do that in a process function than in a preprocess function ?

My issue is about integrate this feature in the basic theme (as it was in the d6 version)

cheers

#3

Version:7.x-2.x-dev» 7.x-3.x-dev
Status:active» closed (fixed)

I've added this to the 7.x-3.x branch inside the preprocess_page() function. Tested and works.

nobody click here