继续Drupal分享精神 QQ群:107748121 站长QQ:532116351【drupal交流+drupal 建站+theme制作】
登录 注册

Drupa 主题.info 文件配置 自定义Drupa 区域 区块内容

*******
如果想要制作主题,首先在你的sites/all/themes 下建立一个你要制作的主题文件夹,比如,我来制作一个主题命名叫hellodrupal,那我就在themes目录下面建立一个hellodrupal的文件夹。

1.建立一个.info后缀文件,我这个就叫 hellodrupal.info。
然后在里面定义一些信息。主要的变量有以下:
* name 需要 (主题名词)
* description //主题描述
* screenshot // 主题截图
* version //版本
* core 需要 //使用内核
* engine 需要 //模板引擎
* base theme
* regions // 区域定义
* features // 主题特征定义
* stylesheets // CSS
* scripts //JS
* php // PHP 版本

drupal自带 garland模板主题的例子。此文件位于themes下面的 garland 文件下的 garland.info
; $Id: garland.info,v 1.5 2007/07/01 23:27:32 goba Exp $
name = Garland
description = Tableless, recolorable, multi-column, fluid width theme (default).
version = VERSION
core = 6.x
engine = phptemplate
stylesheets[all][] = style.css
stylesheets[print][] = print.css

; Information added by drupal.org packaging script on 2008-02-13
version = "6.0"
project = "drupal"
datestamp = "1202913006"

*******
(features)特征定义好以后,可以在后台配置的时候,选择是否开启这样的功能
features[] = logo
features[] = name
features[] = slogan
features[] = mission
features[] = node_user_picture //
features[] = comment_user_picture // 用户评论列表显示头像
features[] = search
features[] = favicon
; These last two disabled by redefining the
; above defaults with only the needed features.
; features[] = primary_links
; features[] = secondary_links

今天在琢磨那个drupal的主题,也就是默认的主题。想自己来设计一个,不懂,我可以慢慢来学习默认的主题。
首先看说明就对.info来分解。网络资料是真丰富。首先regions 区域可以自己定义。
regions[left] = Left sidebar
regions[right] = Right sidebar
regions[content] = Content
regions[header] = Header
regions[footer] = Footer
默认的
自己定义也可以 regions[leftads] = Left ads
定义好.info文件然后上传到服务器里面。在后台就可以看到效果,它会提示说 Left ads区域里没有区块内容。这是你可以自己添加区块内容, 可以定义一个广告区块。
记着保存。然后就ok。不过让人失望,打开node页面没有效果。最后发现自己还没有用变量$leftads调用,再page.tpl.php里面调用就可以了。

<?php
print $leftads;
?>

看看默认主题里面 用 if 来判断。

<?php if (!empty($header)): ?>
        <div id="header-region">
          <?php print $header; ?>
        </div>
      <?php endif; ?>

      <?php if (!empty($left)): ?>
        <div id="sidebar-left" class="column sidebar">
          <?php print $left; ?>
        </div> <!-- /sidebar-left -->
      <?php endif; ?>

评论

你这 $leftads

你这 $leftads 变是从那里来的

========================
http://www.b2b-m.com

自己定义也可以 regions[leftads] =

自己定义也可以 regions[leftads] = Left ads

发表新评论

此内容将保密,不会被其他人看见。
  • 自动将网址与电子邮件地址转变为链接。
  • 自动断行和分段。
  • You can use BBCode tags in the text.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.

更多关於格式化选项的信息

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.