国外设计欣赏网站 - 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排序条件即可。
下面就是随机排序设置的截图:

* [, a; f4 Q; k& Y0 w

Drupal Ramdon Articles 设置步骤:

- g$ J! W- F, C1 L- F
1.create a new view in administer » views » add tab.
在administer » views » add tab新建一个views

7 n. u8 A' w0 K9 C2 L* e0 W! P" W2.give it a name. I called mine "Random".
7 c: p# V1 P2 b( g1 K4 K' R4 D命名,我用的名字是"Random".1 W! }% Y3 V0 C: W3 T% ~
$ S( A- M+ e- n5 P  m
3.click the "Block" section heading to get its settings.- `" @/ a* k3 T4 ?' Z/ V
点击 "Block"部分的标题,以获得其设置。
! n( y0 g6 S' D' [+ M9 o$ B" C
- m  ~  I( j# ^/ Q8 z4.enable "Provide block"' g! Y! c+ f; m6 B. T+ D& u# g
启用"Provide block"
; _, ]' ]5 {5 k$ v
1 G  k6 d% g' W) s4 E8 o3 B5.choose a "View type". I went with "List View" so that I could choose which fields display in the block.
( R9 d0 Z. x3 D% C; w选择一个“View type 视图类型” 。选的“List View 列表视图”,这样我可以选择在哪些领域显示块。
% x+ ]9 S9 s; F8 ~, x$ T. d0 N5 a  k6 A( m1 |0 [( X7 Q
6.type in a title. This will be the title of the block.
2 v* D1 D* J2 T" `键入标题。作为Block块的标题。# H3 e* @( z& \
3 V1 I% \+ m; Z! y
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 B6 Z5 s2 Y; m6 A7 j  D在您想要显示的块节点上键入一个数字值。如果你愿意,你可以用1 (数字1) 。; Z: }, o# N1 f! p3 \

! z8 F1 k" }  U  T4 K
/ ~4 B) f+ z+ R8.click the "Fields" section heading to get its settings.  `2 K1 R1 r0 c* P6 D! z$ M
单击“Fields字段”部分的标题,以获得其设置。( @, U% W$ S0 ^0 \" {( O/ ]% w
8 g9 a# k2 e% t1 M5 g# Z# K! E
9.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.
8 R4 y$ }. B: F$ R; U添加你想要的Fields领域。我只是选择“Node: Title节点:标题 ”因为我想只是链接到的节点,而不是节点的文本本身。你应该能够选择任何领域有报价在CCK的节点。
' [* h4 E, \9 Z# |# E& L' J
9 u6 W1 ]$ v2 ]( Z* a: P10.click the "Filters" section heading to get its settings.( t2 `8 ]5 N3 v& |$ I
点击“Filters过滤器”一节的标题,以获得其设置。9 f' _" }- i$ o1 B( C# \% X8 C
  ~7 L9 H) T7 C& P6 ^5 L
11.select "Node: Type" and click "Add Filter"
" w2 }; b; T+ T9 C8 I选择“Node:Type节点类型” ,然后点击“添加Filter过滤器”
8 ^& C6 D$ G" t/ S9 k: `
  L7 [) u/ B# v5 I12.choose the CCK node type(s) you want to appear in the block.6 e% E5 _; M" q+ Q) [. t4 D
选择了CCK节点类型type(S)你要出现在块。! J% P' Q8 A1 f+ Y
5 U1 G2 J4 o6 L6 v2 v) z
13.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.
- U: ^1 b8 D7 n! R8 W5 K选择“Node:Published节点:发布” ,点击“添加过滤器Filter”。(我一直忘了这一个,但它是重要的,因为你可能不希望显示未发表的节点。
% f, |' h2 `+ p2 w
$ H' _, H, @6 ~9 ^14.click the "Sort criteria" section heading to get its settings.- `3 l+ H  p* u9 x; `
点击“Sort criteria排序标准”部分的标题,以获得其设置。
  ], b" c7 @* K
$ c8 I# w- z* h8 A. g15.select "Random" and click "Add criteria".
; i) B# j" k1 ^$ A$ N/ ^3 p. k# u: P选择 "Random",点击 "Add criteria".3 e, ]6 Z0 k3 |7 `! N0 ~; Z" X( P" W
( {+ q, m5 h4 o, m
16.click "Save"8 g- |6 ~" `7 f8 p& p  j. z
点击保存' M% \- S0 i2 n. N1 U9 S, e

; {1 \) u! K3 S17.click administer » blocks and enable the block you titled in step #6.$ ^9 w+ Z6 h( G, D# q/ f
点击administer » blocks,并启用第6步设置标题的Block快。
# t; i4 t! Z' N5 S# V; C* R- ?6 s+ [, j1 g$ }
----------------------------------------------------------------------------------------------5 ?5 m- s% x8 i( b/ }1 y- b" j0 L* r1 x
8 V( i0 y+ E2 b2 Y* w4 s! `
DOOOOR国外设计论坛 www.doooor.com---Howfar翻译!转载请注明,谢谢!3 E% b% r( ]  S2 F+ g

; J2 G) b: g5 X1 q1 H+ P7 w
2 w& i' C) ]% U. g* _/ G0 y  A+ w: }9 o2 R* t
' [3 h0 x2 p6 E; H& E, C* r1 Z

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

GMT+8, 7-19-2025 07:36 , Processed in 0.704011 second(s), 55 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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