Drupal 7 开发内部培训资料, 分头诗人

通过node.tpl.php复写,分页显示node。

标签: node

如果不使用view,一个node.tpl.php复写,怎么在node.tpl.php中分页显示node

<?php if ($node->type=="forum"): ?>
  <?php global $base_url;?>

<?php print forums_left_contents()?>
    <?php print render($content['links']); ?>

<div id="forums">

<!--      <div id="node-<?php print $node->nid; ?>" class="<?php print $classes; ?> clearfix"<?php print $attributes; ?>>

      <?php print $user_picture; ?>

      <?php print render($title_prefix); ?>
      <?php if (!$page): ?>
        <h2<?php print $title_attributes; ?>><a href="<?php print $node_url; ?>"><?php print $title; ?></a></h2>
      <?php endif; ?>
      <?php print render($title_suffix); ?>

      <?php if ($display_submitted): ?>
        <div class="submitted">
          <?php print $submitted; ?>
        </div>
      <?php endif; ?>

      <div class="content"<?php print $content_attributes; ?>>
        <?php
          // We hide the comments and links now so that we can render them later.
          hide($content['comments']);
          hide($content['links']);
          print render($content);
        ?>
      </div>   -->


<div class="indlag_title">
                 
                   <ul>
                   
                       <li class="inda"><img src="<?php print $base_url?>/sites/all/themes/danishclassic/images/indlag.png"></li>
                        <li class="titel"><?php print $title; ?></li>
                        <li class="time"><?php print $date;?></li>
                   
                    </ul>
                   
                    <div class="clear"></div>
</div>

<div class="indlag_info">
                 
                   <div class="indlag_img">
                   
                     <div class="photo_img"><?php
                     
                      if(!empty($user_picture)){
                           print $user_picture;
                      }else{
                     
                       print  '<img src="'.$base_url.'/sites/all/modules/custom/training/images/user.jpg" height="70" width="70" />';
                      }
                     
                
                     
                     
                      ?>
                     
                     
                      </div>
                       
                        <div class="photo_name"><?php print $name;?></div>
                   
                    </div>
                   
                    <div class="photo_descrip">
                   
                     <div class="photo_descrip_info">
                     
                            <div class="content"<?php print $content_attributes; ?>>
                              <?php
                                // We hide the comments and links now so that we can render them later.
                              
                          
                                print render($content);
                              ?>
                            </div> 

                      </div>
                       
                        <div class="mark"><img src="<?php print $base_url?>/sites/all/themes/danishclassic/images/mark.jpg"></div>
                   
                    </div>
                 
                    <div class="clear"></div>
                 
  </div> 



  

      <?php print render($content['comments']); ?>

        <?php drupal_add_library('system', 'ui.position'); ?>
  <?php drupal_add_library('system', 'ui.resizable'); ?>
  <?php drupal_add_library('system', 'ui.dialog'); ?>

<script>
jQuery(function() {
   
   jQuery("#forums_comment_from").dialog({
        width: 460,
        autoOpen: false,
        resizable: false,
        draggable: true,
        modal: true
    });
   
    jQuery("#opener").click(function() {
        jQuery("#forums_comment_from").dialog("open");
        return false;
    });


   
});
</script>


<div class="post_reply"  id="opener"><a href="#">Post reply</a></div>
 
       
               
              
               
                <div class="clear"></div>



</div>

<div class="watch"><img src="<?php print $base_url?>/sites/all/themes/danishclassic/images/watch.gif"></div>

上面就是代码,下面是截图

评论

分头诗人的头像

好文,我把文章转到博客中