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

问题描述:

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.

现在,我的博客文章是作为主要内容区域中的节点生成的。 在我的内容块中,只有一个块,而博客导航需要在博客帖子之上,并且它有非常自定义的标记 - 我怎么能扭转订单? 我不知道在哪里移动帖子。 p>

澄清 strong>:我需要我的块才会显示在主页上,博客文章位于 我需要它在博客文章上方显示。 p> div>

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.

You can control the visibility of blocks in it's settings in three ways:

  • PHP statement
  • On all pages except listed
  • Only on listed pages