Skip to Content

Drupal主题:为摘要(teaser)页面制作专门的主题模板

  • strict warning: Non-static method view::load() should not be called statically in /var/www/drupal_module/views/views.module on line 906.
  • strict warning: Declaration of views_handler_filter::options_validate() should be compatible with views_handler::options_validate($form, &$form_state) in /var/www/drupal_module/views/handlers/views_handler_filter.inc on line 0.
  • strict warning: Declaration of views_handler_filter::options_submit() should be compatible with views_handler::options_submit($form, &$form_state) in /var/www/drupal_module/views/handlers/views_handler_filter.inc on line 0.
  • strict warning: Declaration of views_handler_filter_node_status::operator_form() should be compatible with views_handler_filter::operator_form(&$form, &$form_state) in /var/www/drupal_module/views/modules/node/views_handler_filter_node_status.inc on line 0.
  • strict warning: Declaration of views_plugin_row::options_validate() should be compatible with views_plugin::options_validate(&$form, &$form_state) in /var/www/drupal_module/views/plugins/views_plugin_row.inc on line 0.
  • strict warning: Declaration of views_plugin_row::options_submit() should be compatible with views_plugin::options_submit(&$form, &$form_state) in /var/www/drupal_module/views/plugins/views_plugin_row.inc on line 0.
  • strict warning: Non-static method view::load() should not be called statically in /var/www/drupal_module/views/views.module on line 906.
  • strict warning: Non-static method view::load() should not be called statically in /var/www/drupal_module/views/views.module on line 906.
  • strict warning: Non-static method view::load() should not be called statically in /var/www/drupal_module/views/views.module on line 906.
  • strict warning: Declaration of views_handler_field_comment::init() should be compatible with views_handler_field::init(&$view, $options) in /var/www/drupal_module/views/modules/comment/views_handler_field_comment.inc on line 0.
  • strict warning: Declaration of views_handler_filter_boolean_operator::value_validate() should be compatible with views_handler_filter::value_validate($form, &$form_state) in /var/www/drupal_module/views/handlers/views_handler_filter_boolean_operator.inc on line 0.

有下面的三种方法可以为摘要页面制作单独的主题:

方法一:

<?php
if ($teaser) { 
  // node is being displayed as a teaser
  // Anything here will show up when the teaser of the post is viewed in your taxonomies or front page
} else { 
  //all other cases
  //Anything here will show up when viewing your post at any other time, e.g. previews
}
?>

方法二:

  <?php if ($teaser): ?>
    <!-- teaser template HTML here -->
  <?php else: ?>
    <!-- regular node view template HTML here -->  
  <?php endif; ?>

方法三:

<?php
if ($teaser) { //if node is being displayed as a teaser
  //Anything here will show up when the teaser of the post is viewed in your taxonomies or front page
} elseif ($page) { //if node is being displayed as a full node
  //Anything here will show up when viewing only your post
} else { //all other cases
  //Anything here will show up when viewing your post at any other time
}
?>

参考页面:
http://drupal.org/node/53464

-- EOF-TRUEVUE --