doutangqi4444 2010-02-12 10:44
浏览 24
已采纳

重新排列博客文章与内容块的排序?

Right now, I have blog posts being generated as nodes in my main content area. In my content block there's only one block and that's for the blog navigation which needs to be on top of the blog posts and it has very custom markup - how could I reverse the order? I'm not sure where to move the posts down.

Clarification: I need my block to show up on the homepage only, where the blog posts are and I need it to show above the blog posts.

  • 写回答

2条回答 默认 最新

  • doudao9915 2010-02-16 09:41
    关注

    Unfortunately, there isn't an easy way of accomplishing this through the graphical administrative interface, so you'll probably have to get into your theme code to make this change. IMO, the easiest way to do this is to define a new block region.

    If you're using a contributed/core theme, you might want to define a sub-theme of your current theme to make the change in. See http://drupal.org/node/225125 for more information about subthemes.

    To create a new block region, you need to add it to your theme's .info file

    
    name = My Theme
    description = Example
    core = 6.x
    engine = phptemplate
    
    regions[left] = Left Sidebar
    regions[right] = Right Sidebar
    regions[content] = Content
    regions[header] = Header
    regions[footer] = Footer
    regions[above_content] = Above content
    
    

    Here, in addition to the default regions (left, right, content, header, footer), the theme has a custom region called above_content.

    Then, edit your theme's page.tpl.php file, and add the $above_content variable to the template where it will display above the content. For example, if you were extending the Garland theme, you could add the $above_content variable like so:

    ...
    <div id="center"><div id="squeeze"><div class="right-corner"><div class="left-corner">
              <?php print $breadcrumb; ?>
              <?php if ($mission): print '<div id="mission">'. $mission .'</div>'; endif; ?>
              <?php if ($tabs): print '<div id="tabs-wrapper" class="clear-block">'; endif; ?>
              <?php if ($title): print '<h2'. ($tabs ? ' class="with-tabs"' : '') .'>'. $title .'</h2>'; endif; ?>
              <?php if ($tabs): print '<ul class="tabs primary">'. $tabs .'</ul></div>'; endif; ?>
              <?php if ($tabs2): print '<ul class="tabs secondary">'. $tabs2 .'</ul>'; endif; ?>
              <?php if ($show_messages && $messages): print $messages; endif; ?>
              <?php print $help; ?>
              <div class="clear-block">
                <?php print $above_content ?>
                <?php print $content ?>
              </div>
              <?php print $feed_icons ?>
              <div id="footer"><?php print $footer_message . $footer ?></div>
          </div></div></div></div> <!-- /.left-corner, /.right-corner, /#squeeze, /#center -->
    ...
    

    You can then add the block to the 'Above content' region on the block admin page and set it to only display on the front page.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题