代码之家  ›  专栏  ›  技术社区  ›  Ganesh

Drupal 7如何在自定义主题中添加内容

  •  0
  • Ganesh  · 技术社区  · 11 年前

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

    我有 .info , page.tpl.php style.css file .

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

    我该怎么做?我已添加 print render($page['content']); 在里面 第tpl.php页 但它不起作用。

    1 回复  |  直到 11 年前
        1
  •  1
  •   JSunny    11 年前

    您需要在.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.

    请遵循文件夹和文件命名结构。

    推荐文章