### Eclipse Workspace Patch 1.0 #P drupal-contrib-6--1 Index: modules/sections/sections.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/sections/sections.module,v retrieving revision 1.21.2.3 diff -u -r1.21.2.3 sections.module --- modules/sections/sections.module 25 Dec 2007 11:32:58 -0000 1.21.2.3 +++ modules/sections/sections.module 5 Mar 2008 19:26:40 -0000 @@ -146,7 +146,7 @@ } else { // caller wants to know in which section she is. - $res = db_query('SELECT path, status, visibility, theme, weight FROM {sections_data} WHERE status=1 ORDER BY weight'); + $res = db_query('SELECT sid, name, path, status, visibility, theme, weight FROM {sections_data} WHERE status=1 ORDER BY weight'); while ($row = db_fetch_object($res)) { if ($row->visibility == 1) { // This bizarre bit of magic courtesy of block.module @@ -165,3 +165,16 @@ } return $output; } + +function sections_preprocess_page(&$variables) { + // Add multiple suggestions. + if ($section = _sections_in_section()) { + // Try to find a page template with section id. + $variables['template_files'][] = 'sections-page-'. $section->sid; + + // Try to find a page template named like the section. + $filter = '![^abcdefghijklmnopqrstuvwxyz0-9-_]+!s'; + $string_clean = preg_replace($filter, '-', drupal_strtolower($section->name)); + $variables['template_files'][] = 'sections-page-'. $string_clean; + } +}