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

% H- j8 ]! H7 M6 u9 L; H3 ^4 [3 m

Drupal Ramdon Articles 设置步骤:
$ @' b# e) j  J3 U3 z$ j& S, Y7 N7 P8 H
1.create a new view in administer » views » add tab.
在administer » views » add tab新建一个views

0 ^/ u& Q0 u& q# @" G/ s2.give it a name. I called mine "Random".
1 ~0 ~1 q- L% l8 P( j2 M命名,我用的名字是"Random".: z9 E# e" v* ?/ n! Q

8 _4 v& m1 A$ _" b. R3.click the "Block" section heading to get its settings.
! p' A& [  x4 P0 I: t2 E0 ~点击 "Block"部分的标题,以获得其设置。& V6 t$ v! w2 J5 ~- P, s% l
% B( N5 k& V- j( `, U, G
4.enable "Provide block"
% I6 Y' `' `* H( G" \% c启用"Provide block"
4 ^# X; I; P8 J8 w+ P9 f- D# I/ J- U  j- o2 b
5.choose a "View type". I went with "List View" so that I could choose which fields display in the block.
. t' L' @* ]% t+ J2 R( D0 R( Y选择一个“View type 视图类型” 。选的“List View 列表视图”,这样我可以选择在哪些领域显示块。( V: e' g; n9 i7 C' ^- M) E8 J
# Z: O! M1 @" A# N& w, R2 P
6.type in a title. This will be the title of the block.
1 C# K7 B/ `, E键入标题。作为Block块的标题。
  w$ ^: p( h9 \, F
2 K: W# [& J' }, M8 t7.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.
1 y3 i7 B* a. `5 T7 W1 G' Y在您想要显示的块节点上键入一个数字值。如果你愿意,你可以用1 (数字1) 。# A% \/ G% O  i& p/ l

, g& v9 `5 }. P3 R) S0 x9 b) q" C- A# D% k! Q
8.click the "Fields" section heading to get its settings.
& B1 ]! j% S! P$ [单击“Fields字段”部分的标题,以获得其设置。
" v, l" B) {9 a* A0 W: a
8 Z4 e8 \) S2 I9 G& @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.
4 M8 R+ D, I/ T: M* v) v# I添加你想要的Fields领域。我只是选择“Node: Title节点:标题 ”因为我想只是链接到的节点,而不是节点的文本本身。你应该能够选择任何领域有报价在CCK的节点。. t" @3 X) \3 k  l
/ V! ?1 l5 y2 @3 K$ @
10.click the "Filters" section heading to get its settings.
9 y4 [+ l( _5 l- F# Y点击“Filters过滤器”一节的标题,以获得其设置。
1 T0 \6 e- C0 k7 H$ G3 v
: S/ o9 t4 J% \+ D9 H7 a. g* Z11.select "Node: Type" and click "Add Filter"
! ^/ x1 r0 t9 c" w" n( g0 I! F4 ]1 Q选择“Node:Type节点类型” ,然后点击“添加Filter过滤器”
6 ~6 J$ S5 f( \, v7 B. a6 b. I# q% C8 |+ g
12.choose the CCK node type(s) you want to appear in the block.3 i: T5 @6 r% y9 m
选择了CCK节点类型type(S)你要出现在块。3 j! k) ^1 a& W" q3 o1 _+ N3 l- e
1 S9 _% T! R& j" T3 n. u
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.
6 d; j, U0 w! ^4 h4 C/ v选择“Node:Published节点:发布” ,点击“添加过滤器Filter”。(我一直忘了这一个,但它是重要的,因为你可能不希望显示未发表的节点。
. v5 Q* b6 K7 Q- K6 `
9 G0 x; X$ [$ n) k9 F! f/ h14.click the "Sort criteria" section heading to get its settings.
* T3 m5 I2 M' F点击“Sort criteria排序标准”部分的标题,以获得其设置。
# O* G+ @8 M% D& m  K
: ?( P9 i& q6 t4 c/ q& ^9 j' W15.select "Random" and click "Add criteria".4 e* z  T4 ~* j- Y4 }& d4 f
选择 "Random",点击 "Add criteria".
5 m5 w4 i3 m: U# H+ o, P
4 R' _" k0 p7 s! y16.click "Save"
: K* r+ g0 T6 f点击保存- d$ ?) P. t: M# b- N- y
6 M5 X& m; r$ k2 S+ \' J# U/ u! R
17.click administer » blocks and enable the block you titled in step #6.
4 u8 p# d( B" b* v0 m- R7 Q点击administer » blocks,并启用第6步设置标题的Block快。
7 Z4 W+ j- j/ t" {/ b1 i7 A6 n+ v) ~1 Y) b2 J# k: z( O( s. V
----------------------------------------------------------------------------------------------) ]2 G, P0 Z- _) x5 b! U  O- f" w" {
  r; t3 I( h9 F3 O
DOOOOR国外设计论坛 www.doooor.com---Howfar翻译!转载请注明,谢谢!
+ N. p' n$ H# I1 u' m+ w5 R
( `, n) V( I9 ]' d4 r" E' l/ K' Y6 m6 @/ r7 e- b% i
8 {5 U, L1 F( ~: N7 B4 E* b
5 V5 l6 U! v, B# j: A7 Y

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

GMT+8, 7-11-2025 10:44 , Processed in 1.544039 second(s), 53 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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