简体   繁体   English

Drupal Views问题

[英]Drupal Views question

I want to display a different set of 2 or 3 images in a block on each page. 我想在每页的一个块中显示一组不同的2或3张图像。 So far, I have: 到目前为止,我有:

  • Added images to each page using CCK and filefield. 使用CCK和文件字段将图像添加到每个页面。

  • Removed the images from $content. 从$ content中删除了图像。

  • Created a view with node ID (Nid) as the argument, and added the field created with CCK, and added display type of Block. 创建一个以节点ID(Nid)作为参数的视图,并添加使用CCK创建的字段,并添加了“块”的显示类型。

When I try the Live Preview, it will display all the images for all pages in the block. 当我尝试实时预览时,它将显示该块中所有页面的所有图像。 When I enter the Node ID variable, it adds a where clause to the sql query and displays the correct images for that page. 当我输入Node ID变量时,它将在SQL查询中添加where子句并显示该页面的正确图像。

How (where) do I set it up so that the view recognizes that it is on Node 3 and displays only the images for Node 3. 我如何(在哪里)进行设置,以使视图识别出它位于节点3上,并仅显示节点3的图像。

Thanks 谢谢

John 约翰

  1. "How (where) do I set it up so that the view recognizes that it is on Node 3 and displays only the images for Node 3." “如何(在何处)进行设置,以使视图识别出它位于节点3上,并仅显示节点3的图像。” -- you can do this by clicking on the settings for the Nid argument in Views. -您可以通过在“视图”中单击Nid参数的设置来执行此操作。 Under Action to take if argument is not present: choose Provide Default Argument . Action to take if argument is not present:Action to take if argument is not present:Action to take if argument is not present:选择Provide Default Argument In that, choose Node ID from URL 在那, Node ID from URL选择Node ID from URL
  2. Position your block in the appropriate region (left sidebar, right sidebar etc). 将块放置在适当的区域(左侧边栏,右侧边栏等)。 Make sure the visibility settings of the block are such that it only appears at paths that match node/* 确保该块的可见性设置使其仅出现在与node/*匹配的路径上

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM