基于url的Drupal页面模板文件
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了基于url的Drupal页面模板文件相关的知识,希望对你有一定的参考价值。
//Drupal 5 <?php switch ($hook) { case 'page': // Add page template suggestions based on the aliased path. // For instance, if the current page has an alias of about/history/early, // we'll have templates of: // page-about-history-early.tpl.php // page-about-history.tpl.php // page-about.tpl.php // Whichever is found first is the one that will be used. if (module_exists('path')) { if ( $alias != $_GET['q'] && $alias == $_REQUEST['q'] ) { $template_filename = 'page'; $template_filename = $template_filename . '-' . $path_part; $suggestions[] = $template_filename; } } $vars['template_files'] = $suggestions; } break; } return $vars; } ?> //Drupal 6 <?php function phptemplate_preprocess_page(&$vars) { if (module_exists('path')) { if ($alias != $_GET['q']) { $template_filename = 'page'; $template_filename = $template_filename . '-' . $path_part; $vars['template_files'][] = $template_filename; } } } } ?>
以上是关于基于url的Drupal页面模板文件的主要内容,如果未能解决你的问题,请参考以下文章
php 基于内容类型的Drupal 8自定义页面模板(建议)(页面 - [content-type] .html.twig)