Display Defaults"uses fields but there are none defined for it or all are excluded. 由于我们把Row Style设置成了"Fields”,但是我们还没有给出可用的Field,所以才有这个警告出现.接下来,我 们定义一个Field,.点击Fields旁边的+号: + defined 下面会出现Fields详细设置表单,因为我们只想在区块中显示文章的标题,因此,我们只定义一个Node Title就可以 Defaults:Add fields 口Node:Published node ublihed. 口Node:Stick thenode is Node:Teaser 回Node:Title field.This mayo □Node:Type Node:Updated date xample,g Node:Updated/con date Node revision:Created date Add Cancel 点击add按钮。进入T心e的详细配置界面。清除标签中的Te字样,因为我们只想显示标题本身,而不是显示成 Title::这是一个标愿"。选中Link this field to its node”",然后点击"Update'"按钮,如下图: Defaults:Configure field Node:Title Label: 清除这里Tue字样 abel for this field that will be displayed to end u □Exclude from display Link this field to its node Update Cancel Remove 设置Arguments 要想显示相关文章,关键在于Arguments的设置,我们希望找出正在阅读的节点的Taxonomy items,然后选出具 有同样taxonomy items的文章,点击Arguments旁边的+"号: + 下面会出现Arguments的设置界面,我们选中Taxonomy::Term ID"做为参数,然后点击"add"按钮: 11
11 由于我们把 Row Style 设置成了 “Fields”,但是我们还没有给出可用的 Field,所以才有这个警告出现。接下来,我 们定义一个 Field,点击 Fields 旁边的 + 号: 下面会出现 Fields 详细设置表单,因为我们只想在区块中显示文章的标题,因此,我们只定义一个 Node Title 就可以 了: 点击 add 按钮,进入 Title 的详细配置界面,清除标签中的“Title”字样,因为我们只想显示标题本身,而不是显示成 “Title: 这是一个标题”。选中“Link this field to its node”,然后点击“Update”按钮,如下图: 设置 Arguments 要想显示相关文章,关键在于 Arguments 的设置,我们希望找出正在阅读的节点的 Taxonomy items,然后选出具 有同样 taxonomy items 的文章,点击 Arguments 旁边的“+”号: 下面会出现 Arguments 的设置界面,我们选中“Taxonomy: Term ID ”做为参数,然后点击“add”按钮:
Defaults:Add arguments enode revision 回Taonomy:-Tem Taxonomy:Term ID (with depth) is me Taxonomy:Vocabulary ID e taxo my vocabulary ID Add Cancel 接下来在出现的Arguments详细设置界而中,在Action to take if argument is not present中,选中Provide default argument",然后在Default argument type中选中"PHP code”,并填入如下代码 Snode =node_load(arg(1)); f(Snode 6 Snode->taxonomy)( foreach (Snode->taxonomy as $term){ Sterms[]=Sterm->tid; return implode('+,Sterms) else return: 如下图所示 12
12 接下来在出现的 Arguments 详细设置界面中,在 Action to take if argument is not present 中,选中“Provide default argument”,然后在 Default argument type 中选中“PHP code”,并填入如下代码: $node = node_load(arg(1)); if ($node && $node->taxonomy){ foreach($node->taxonomy as $term) { $terms[]=$term->tid; } return implode('+',$terms); } else { return; } 如下图所示:
Defaults:Configure Argument Taxonomy:Term ID Action to take if argument is not present 8网 ding title to use for the w Provide default ent type OFed 8Rn PHP argument code e(m-em else(retum;】 在下面的选项中选中Allow multiple terms per argument.."和"Reduce duplicates"”,这样允许参数为"1+2+3"这 样的形式,同时消除重复的节点,完成后点击"Update“按钮,如下图所示: Allow mutiple terms per argument. nts in the fom Allow multiple arguments to work together. ork to snot compatible with the"Reduce duplicates"setting. Do not display items with no value in summary ☑Reduce duplicates his with cautio Set the breadcrumb for the term parents Update cancel Remove 现在,我们创建一个区块,以便以后在Administor>Site building>Blocks中把它放置在适当的位置,如下图,在 Views编辑界面的左上角,下拉菜单中选则block,然后点击"Add display"按钮,如下图所示: 13
13 在下面的选项中选中“Allow multiple terms per argument. ”和“Reduce duplicates”,这样允许参数为“1+2+3”这 样的形式,同时消除重复的节点,完成后点击“Update”按钮,如下图所示: 现在,我们创建一个区块,以便以后在 Administor > Site building > Blocks 中把它放置在适当的位置,如下图,在 Views 编辑界面的左上角,下拉菜单中选则 block,然后点击 “Add display”按钮,如下图所示:
Block Block Add display Analyze 现在大功告成了,把这个区块放在Left Sidebar或Right Sidebar上,当我们浏览文章时,相 关文章就会显示在这个区块中。不过还有点小问题,我们当前正在浏览的节点也会显示在区块中,怎么才能把它去掉呢 Administer,Site building,Views,在下面的列表中找到我们的relative articles,点击"Edit",进入编辑界面, 再添知一个Arguments,类型为"Node:Nid",达择"Provide default argument",Default argument type:设 置为“Node ID from URL”,最后选中下面的"Exclude the argument",如下图所示: Defaults:Configure Argument Node:Nid Action to take if argument is not present: Display all values Provide default argument options Default argument type 8Banae Allow multiple terms per argument the form of++ Update Cancel Remove 怎么样,这回可以了吧? -END- VIEWS實作公告+分類 14
14 现在大功告成了,把这个区块放在 Left Sidebar 或 Right Sidebar 上,当我们浏览文章时,相 关文章就会显示在这个区块中。不过还有点小问题,我们当前正在浏览的节点也会显示在区块中,怎么才能把它去掉呢? Administer › Site building › Views,在下面的列表中找到我们的 relative_articles,点击“Edit”,进入编辑界面, 再添加一个 Arguments,类型为 “Node: Nid”,选择“Provide default argument”,Default argument type: 设 置为 “Node ID from URL”,最后选中下面的"Exclude the argument",如下图所示: 怎么样,这回可以了吧? ――――――――――――END――――――――――――― VIEWS 實作公告+分類
首真 所辦公告 公勿年度所充生颜角文大口秋隔表 4题6日前 带才雨立南革大擎智彩开究所伤聘再任轨体事 7通3日前 根攘您的贴圖侗人估計是在同一侗content type下給定一侗特定的分短(Taxonomy),再使用Vews来進行整理與 题示。作法如下: l.先新增一個Content type-.Name:公告Type:announcement。.其他於content type的設定,暂不述, 公告Manage fields Display fields Identification Type: nnouncement of this content type.This 2.新增一偶分類Add vocabulary Home>Administer>Content management Taxonomy List Add vocabulary View help Name Type Forums Forum topic 15
15 根據您的貼圖個人估計是在同一個 content type 下給定一個特定的分類(Taxonomy),再使用 Views 來進行整理與 顯示。作法如下: 1.先新增一個 Content type-Name:公告 Type:announcement。其他關於 content type 的設定,暫不贅述。 2.新增一個分類 Add vocabulary