【问题标题】:Drupal 7 how to add content in custom themeDrupal 7 如何在自定义主题中添加内容
【发布时间】:2014-07-24 06:51:51
【问题描述】:

我正在 drupal 7 中开发我的自定义主题。

我有 .infopage.tpl.phpstyle.css file

我想在我的主题中添加内容(来自管理面板文章和其他内容)

我将如何做到这一点?我在page.tpl.php 中添加了print render($page['content']);,但它不起作用。

【问题讨论】:

    标签: php drupal-7 drupal-theming


    【解决方案1】:

    您需要在 .info 文件中声明区域,

    name = themename
    description = Your theme description.
    version = 7.x
    core = 7.x
    stylesheets[all][] = css/style.css 
    
    scripts[] = js/yourscript.js 
    
    
    regions[left] = Left sidebar
    regions[right] = Right sidebar
    regions[content] = Content
    regions[header] = Header
    regions[footer] = Footer
    

    然后清除缓存以影响更改。

    您可以使用相同的<?php print render($page['content']); ?> 来显示 page.tpl.php 中的内容

    之后进入管理->结构->块

    将“主页内容”分配给“内容”块

    更详细的documentation here.

    请按照文件夹和文件命名结构。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-11
      • 1970-01-01
      • 2023-03-23
      • 1970-01-01
      • 1970-01-01
      • 2016-08-22
      相关资源
      最近更新 更多