[英]Drupal View, get node id to use a template
How can I get node id for the Drupal View
I just created? 如何获取刚刚创建的Drupal View
节点ID?
The view has a Page path
, and I can see the View
. 该视图具有Page path
,我可以看到该View
。
However, in order to exclude the sidebars from it I had to create a Basic Page and then a template page--node--nodeid.tpl.php
to override it. 但是,为了从中排除侧边栏,我必须创建一个“基本页面”,然后创建一个模板page--node--nodeid.tpl.php
来覆盖它。 Then, in there, I rendered the view. 然后,在那里,我渲染了视图。
But since the View already is a page (I guess) and all content is a node, it should have a node id. 但是由于View已经是一个页面(我想),并且所有内容都是一个节点,因此它应该有一个节点ID。 That way I wouldn't need to create a Basic Page
. 这样,我就不需要创建“ Basic Page
。
I've tried looking at Theme Information
but those templates overrides are for the view, not for the entire page. 我尝试查看Theme Information
但这些模板替代适用于视图,而不适用于整个页面。 Thanks. 谢谢。
Not all content is a node. 并非所有内容都是一个节点。 Your Page View is likely displaying fields from certain other nodes, however. 但是,您的页面视图可能会显示来自其他某些节点的字段。
If your goal is to hide those sidebars on that particular page, you could go into page.tpl.php
and do something like: 如果您的目标是隐藏该特定页面上的那些侧边栏,则可以进入page.tpl.php
并执行以下操作:
<?php
$path = drupal_get_path_alias(current_path());
if($path != "/my/view/path"){
print render($content['my_sidebar_region']);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.