如何在 Drupal 中分离博客块的模板?
在 Drupal 中,我使用视图创建了一个块。该块包含最新的博客条目。我已将其放置在特定页面上以将其显示为存档。现在,对于博客本身(例如,当单击其中一个博客时),它的博客模板依赖于node-blog.tpl.php。我的问题是,当我设置 node-blog.tpl.php 样式时,我为档案创建的块(如页面上显示的那样)会受到影响。
例如,如果我在 node-blog.tpl.php 上添加 TEST,我也会在每个条目的块上得到它。我认为这是因为它与博客条目相关联?我想要的是在单独查看博客条目时将节点博客样式设置为“单独”,并且不会影响存档页面上块上的其他条目。我该怎么做?
In Drupal, I created a block using views. This block contains the latest blog entries. I've placed this on a specific page to display it as an archive. Now, as for the blog itself (for example when one of them is clicked), A blog template for it depends on node-blog.tpl.php. My problem is, when I style node-blog.tpl.php, the block I created for the archives (as it displays on the page) gets affected.
For example if I add TEST on node-blog.tpl.php, I will also get that on the block for every entry. I think it's because it is associated to a blog entry? What I want is to have node-blog styled "alone" when blog entries are viewed individually and not get the other entries on the blocks on the archive page be affected. How should I do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在您看来,您可能正在使用“节点”行样式。这意味着块视图中的每个博客都显示为完整节点,并将受到
node-blog.tpl.php
的影响。解决此问题的最简单方法是将行样式更改为“字段”并选择要在视图中显示的各个字段。然后,您可以使用视图的自定义 .tpl.php 文件单独为每个字段设置主题(您可以在视图中单击
主题:信息
以查看扫描的 tpl.php 文件)。解决此问题的另一种方法是在行样式设置中选择“teaser”构建模式。然后在
node-blog.tpl.php
中执行如下操作:In your view you are probably using the "node" row style. This means that each blog in your block view is displayed as a full node and will be affected by
node-blog.tpl.php
The easiest way to fix this is to change row style to "fields" and select the individual fields to display in the view. Then you can individually theme each field using the view's custom .tpl.php files (you can click on
Theme: Information
in the view to see scanned tpl.php files).Another way to fix this would be to select "teaser" build mode in the row style settings. Then in
node-blog.tpl.php
do something like the following: