新的内容类型,完全空白(仅节点主体)输出主题文件
我有一个内容类型,仅用于我的 drupal 站点上应该返回 json 数据的脚本。因此,问题就变成了我无法在输出中包含该网站的任何主题元素。
所以我知道我需要空白(仅输出变量)tpl 文件用于以下内容: html.tpl.php 页面.tpl.php 区域.tpl.php 块.tpl.php field.tpl.php (手册说这没有被使用,但它是我能找到的删除页面主体周围的字段 div 的唯一方法)
所以我的问题是,如何为此创建所有内容特定文件内容类型?我知道在 template.php 中进行主题覆盖很容易,但我只能让它适用于 html.tpl、page.tpl ,仅此而已。 Drupal 似乎忽略了从区域到领域的任何内容特定功能。
I have a content type that is only used for scripts on my drupal site that should return json data. So the issue then becomes that I can't have any of the theming elements of the site in the output.
So I know I need blank (only the output variable) tpl files for the following:
html.tpl.php
page.tpl.php
region.tpl.php
block.tpl.php
field.tpl.php (the manual says this isn't used but its the only way I could find to remove field divs around the body of my page)
So my question is, how can I create all of the content specific files for this content type? I know its easy to do a theme override in template.php BUT I can only get it to work for html.tpl,page.tpl and thats it. Drupal seems to ignore any content specific functions from region down to field.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我注意到你标记了这个 drupal-7,我还没有尝试过。但是,在 Drupal 6 中,我将通过在 template.php 的页面预处理函数中向 $vars['template_files'][] 添加新的页面模板来实现此目的。示例:
如果您的内容类型称为“scripts”,那么 Drupal 将查找名为 page-scripts.tpl.php 的页面,该页面仅包含一行:
I noticed you tagged this drupal-7, which I haven't tried yet. But, in Drupal 6 I would accomplish this by adding a new page template to $vars['template_files'][] in the page preprocess function of template.php. Example:
If your content type was called 'scripts', then Drupal will look for a page called page-scripts.tpl.php, which will contain only one line: