Themes

playts.com 更换新的主题,采用zen 2.0

每天面对自己站点,时间久了看腻了,于是就想换一个。之前playts.com的主题是采用zen 6.1.x 制作的,目前zen 2.0已经发布了有一段日子,这次制作主题当然首选zen 2.0了。

关于使用zen创建子主题的方法,可以参照zen的文档 ( http://drupal.org/node/193318 ),我之前的blog也介绍过,请看 http://playts.com/node/105http://playts.com/node/105#comment-1666

zen 6.2.x 相对 zen 6.1.x 变化不小。zen 6.1.x 的tpl.php文件和css文件以及js文件全部放在主题的根目录下,而zen 6.2.x是tpl.php放在主题的根目录下的templates目录,css文件放在主题的根目录下的css目录,js文件放在主题的根目录下的js目录。

zen 6.1.x默认regions

regions[left]           = left sidebar
regions[right]          = right sidebar
regions[navbar]         = navigation bar

Drupal 在节点页显示上一篇和下一篇

最近用drupal 6.19制作网站,使用CCK+imagefield来创建相册,每节点一张照片,于是想到能否象手册(book)那样显示下一张照片和上一张照片的导航。最终在这里(Simple previous / next navigation by node title)找到了用代码解决方法。

编辑template.php 增加代码:

<?php
function phptemplate_prev_next($current_node = NULL, $op = 'p') {
  // Node types to include in paging
  $node_types = array('blog');

  if ($op == 'p') {
    $sql_op = '<';
    $order = 'DESC';
  }
  elseif ($op == 'n') {
    $sql_op = '>';
    $order = 'ASC';

Drupal 6 站点离线主题

每次在维护站点时,总是看到Drupal默认的离线主题,这时才会想到要定制自己的站点离线,一次一次的升级过后,还没有改。今日想起此事于是在drupal.org找到相关的文章:Theming the Drupal 6 maintenance page ,并按照文中的指导动手做。

步骤大致如下:

复制你的主题目录下的page.tpl.php 两个副本并重命名为:maintenance-page.tpl.php 和 maintenance-page-offline.tpl.php,并根据自己的需要修改模板文件和风格

然后编辑站点的 settings.php 文件,通常位于 /sites/default 目录下

将行184的内容

# $conf = array(

修改为:

$conf = array(

将行196的内容

#   'maintenance_theme' => 'minnelli',

修改为:

  'maintenance_theme' => 'theme_NAME',

使用zen创建新主题风格

最近使用zen创建新主题风格,发觉的确省时省力、方便快捷,就忍不住把playts.com主题换了一下。修改的地方那个并不多,另外本人不喜欢IE,这个版本基本没有考虑兼容IE。其实zen的框架做的已经很好了。

我把这款主题放在 code.google.com ,需要的朋友可以到这里下载: http://playts.googlecode.com/files/green.tar.gz

或是:svn checkout http://playts.googlecode.com/svn/trunk/

适用于drupal 6,还需要下载主题: http://drupal.org/project/zen

启用green后,点击”配置“ 将 ” LOGO“项不选

另外我的站点安装了GeSHi Filter 和 Tagadelic 模块,在CSS中定义了相关的样式,如果你不需要,请编辑style.css去掉:行925 - 行1000

怎样使用zen创建子主题,请先阅读zen目录下README.txt,不明白的话可以留言讨论。

摘要页2列的简单实现

原文:Two columns of teasers

编辑主题template.php,增加代码:

function _exampletheme_nodebreak($node) {
  static $count;
  if ($node->sticky) {
   return TRUE;
  }
  else {
    $count = is_int($count) ? $count : 1;
    $return = ($count % 2) ? FALSE : TRUE;
    $count++;
    //dprint_r('WOOT');
    return $return;
  }
}

然后编辑主题node.tpl.php,在最后增加代码:

<?php if (($page == 0) && _exampletheme_nodebreak($node)): ?>
<br class="clear" />
<?php endif; ?>

修改主题style.css,增加

#contentcenter .node.teaser {
  float: left;
  width: 223px; //for fluid layout use 50%
  margin-left: 20px; //for fluid layout set to 0;
  padding: 0;
}

交互的摘要页style class

原文:Alternating Teaser Classes

该文章通过修改主题node.tpl.php文件,到达在摘要列表页为node指定不同的样式风格。

主要增加了:

<?php global $node_count; print ($node_count++ % 2) ? 'odd' : 'even'; ?>

来判断是 odd 还是 even,这样我们就可以为 odd 和 even 指定不同的风格样式,如交互背景或是左右分列显示。

同步内容