国外设计欣赏网站 - DOOOOR.com

 找回密码
 注册

QQ登录

只需一步,快速开始

扫一扫,微信登陆

搜索

[Drupal教程] Drupal教程: View实现随机文章的设置方法

[复制链接]
发表于 4-14-2012 00:10 | 显示全部楼层 |阅读模式
WordPress有个插件(Random Articles Wordpress Plugin)可以实现随机文章区块。Drupal好像没有随机文章(Random Articles)模块,那么Drupal怎么实现随机文章区块呢?
其实很简单,用View就可以实现随机文章。只要在Sort Criteria里面选择添加 Global: Random排序条件即可。
下面就是随机排序设置的截图:

( g$ M0 i6 |9 w, \1 e/ l

Drupal Ramdon Articles 设置步骤:
  F$ H3 O* v2 V: T. |
1.create a new view in administer » views » add tab.
在administer » views » add tab新建一个views
. k& l8 F- y& v5 Y/ c
2.give it a name. I called mine "Random".
; m9 o) h- C7 L! @7 e8 A1 Y/ [7 \命名,我用的名字是"Random".
" J8 s/ I  o0 @7 N6 U2 K: D0 @3 i& P$ j) e! L6 I1 ?
3.click the "Block" section heading to get its settings.
  O2 @! q* \2 S& C. H5 p% Q点击 "Block"部分的标题,以获得其设置。
) ~' u# z, p! C0 B$ U1 K8 V  m, [+ b0 y6 p, [+ f) o& Q: j- e
4.enable "Provide block"0 _- ~! g. A% p9 }( O) g8 ~4 F
启用"Provide block": }: b; s/ M8 l' {2 z

7 _+ H2 W. k1 ^/ D* [5.choose a "View type". I went with "List View" so that I could choose which fields display in the block.
; U4 t' G6 F9 Z0 m选择一个“View type 视图类型” 。选的“List View 列表视图”,这样我可以选择在哪些领域显示块。/ g0 `) Z1 Y- [4 v) `3 n4 O2 ]

# P% H2 `& P* p# a- L4 p6.type in a title. This will be the title of the block.2 z. V4 u; Y/ y8 n/ x6 U' {  j
键入标题。作为Block块的标题。6 V" R7 ]7 s1 z6 z- P$ N

/ o! S+ c7 I7 `  g5 Z% a6 h0 \7.type in a number for the amount of nodes you want to display in the block. You can use 1 (number one) if you like.4 i, ^! {8 T" u+ t
在您想要显示的块节点上键入一个数字值。如果你愿意,你可以用1 (数字1) 。" r+ n/ @. P4 r
7 F( S  N- d8 Z- M

/ `3 w$ d$ Q) e- q/ {/ j3 `8.click the "Fields" section heading to get its settings.( D9 j1 F' [, I+ [  }& q9 ~
单击“Fields字段”部分的标题,以获得其设置。: [% X! m* M& B' C$ C8 }

- @7 v) @6 t, n2 M- N" J9.add the fields you want. I chose just "Node: Title" since I wanted just links to the nodes, not the node text themselves. You should be able to choose whichever field has the quote in your CCK node.
5 b6 a9 \, v. J" U; b$ P$ O& E添加你想要的Fields领域。我只是选择“Node: Title节点:标题 ”因为我想只是链接到的节点,而不是节点的文本本身。你应该能够选择任何领域有报价在CCK的节点。
; f7 [% S2 B) b1 D
( P9 L7 G- ]" s8 i" @1 ?10.click the "Filters" section heading to get its settings.
( Z  L4 Y0 d3 D- C& L; ~# ~点击“Filters过滤器”一节的标题,以获得其设置。
) B" J6 n5 ]; Y3 N* \3 Y% Z3 N( f+ {! g) Q! h
11.select "Node: Type" and click "Add Filter"1 u. D8 r' z# B4 E. e/ Y
选择“Node:Type节点类型” ,然后点击“添加Filter过滤器”) \% P/ k4 |5 X+ h5 p) J
0 [; |/ |& [8 H" S1 e0 F0 y' ]
12.choose the CCK node type(s) you want to appear in the block.& l# ^$ N1 I2 h5 `' J- D# m4 C  L/ c
选择了CCK节点类型type(S)你要出现在块。/ p/ B) E4 L6 [% K; G

8 f* f1 p& ]6 h" p: Y6 E9 V7 z13.select "Node: Published" and click "Add Filter". (I keep forgetting this one, but it's important, since you probably don't want to display unpublished nodes.
9 r, h% N3 @/ M5 b( M, o选择“Node:Published节点:发布” ,点击“添加过滤器Filter”。(我一直忘了这一个,但它是重要的,因为你可能不希望显示未发表的节点。0 p+ \  I0 J$ p) j
/ q% O& z: J$ ]- d# E' D9 H' F% W+ C
14.click the "Sort criteria" section heading to get its settings.5 G4 N! c4 W' B7 x) j# M
点击“Sort criteria排序标准”部分的标题,以获得其设置。) e; \" O7 `0 @/ J

. Q& L% l$ h* R# R3 c15.select "Random" and click "Add criteria".
5 e: Q, j" D  X" N/ ~# k选择 "Random",点击 "Add criteria".
6 U1 V7 H% f* f3 e5 Q8 C" v& }1 d- G6 E! ~2 A3 A( i
16.click "Save"
4 O3 M7 e  {  N& u2 s8 \) `点击保存0 G4 u6 ]& [- e; G" |

* c, k1 q' x7 @+ u) X! p! u( z/ F& C17.click administer » blocks and enable the block you titled in step #6.
) O# d3 g% v9 b) H$ s& |点击administer » blocks,并启用第6步设置标题的Block快。, b$ q7 C; d' \, a* A* m% R
& ?( y: O0 z6 n) ^
----------------------------------------------------------------------------------------------/ @0 s4 [, S! ~3 H% g
7 L3 D2 O: U1 B2 H5 A
DOOOOR国外设计论坛 www.doooor.com---Howfar翻译!转载请注明,谢谢!4 P1 s% q5 ~1 I) e2 N8 c5 I
$ V- ~  ]2 ?. F/ w; a* ~; A

' v: W: Q5 G3 W
  P% x% Q, J0 o
7 ~& W  O+ z' n# Y8 T" I0 u) z5 ^1 j

|2011-2026-版权声明|平台(网站)公约|DOOOOR 设计网 ( 吉ICP备2022003869号 )

GMT+8, 2-19-2025 13:59 , Processed in 0.749247 second(s), 54 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表