如何根据当前主题设置 Drupal 块位置
我有一个网站,我应该同时支持 2 个不同的主题。 主题完全不同,我的任务是为每个主题显示不同区域的一些块。
例如:
在“主题 X”中,“搜索块”位于左侧边栏中,旁边还有导航和其他一些块。 对于“主题 Y”,相同的“搜索块”应放置在页面标题中,并且看起来完全不同。
我已从“modules/search”目录复制了文件“search-theme-form.tpl.php”并将其放置在每个主题目录中。设计没有任何问题,但我找不到设置块的主题特定位置的方法。
因此,可以说在“右侧栏”区域中“搜索”“主题 X” 并在“标题”区域中为“主题 Y”具有相同的块
I have a website where I should support 2 different themes at the same time.
Themes are completely different, and I have a task to show some blocks in different regions for each theme.
For example:
In "Theme X" the "Search block" is located in left sidebar alongside with navigation and some other blocks.
For "Theme Y" the same "Search block" should be placed in the header of the page and look completely differently.
I've copied the file "search-theme-form.tpl.php" from "modules/search" directory and placed it inside each theme directory. There is no any problems with design but I can't find the way to set theme specific positions of blocks.
So lets say to have "Search" in "right-sidebar" region for "Theme X"
and have same block in "header" region for "Theme Y"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Drupal 的管理区域已经允许您执行此操作。如果您转到
/admin/build/block
,您将看到一组已安装/活动的所有主题的选项卡。您可以进入每个选项卡以根据特定主题更改块的区域。Drupal's administration area will already let you do this. If you go to
/admin/build/block
you'll see a set of tabs for all the themes you have installed/active. You can go into each of these tabs to change the regions for blocks on a theme specific basis.