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

" z0 o  ?* T. l/ [$ @2 W

Drupal Ramdon Articles 设置步骤:
5 O# A; I( c+ I
1.create a new view in administer » views » add tab.
在administer » views » add tab新建一个views

& K  H+ G; ?) f5 h) A9 g8 n- _# o2.give it a name. I called mine "Random".
+ p* g' d% R' z) Y7 e9 [2 ]" R命名,我用的名字是"Random".0 y% L0 S' ?0 i% k

9 ]9 J5 T; s) @/ E# T3.click the "Block" section heading to get its settings.% n8 X' V8 G; _+ F  x
点击 "Block"部分的标题,以获得其设置。9 a% b# x9 N! E8 a- H% X* c* j! n5 O
9 z7 n& o6 H9 r5 K5 W; y
4.enable "Provide block"
+ K; u9 ]5 N3 v, i' P  |3 [启用"Provide block"
. v7 g/ K" B; C- S9 H4 N& Z2 `  A, o
5.choose a "View type". I went with "List View" so that I could choose which fields display in the block.4 ~9 u/ s! ]$ W; g4 `6 u
选择一个“View type 视图类型” 。选的“List View 列表视图”,这样我可以选择在哪些领域显示块。. t& S# ^3 G/ }; @+ k" m

/ h0 v( e$ V) N- h6.type in a title. This will be the title of the block.. j& @  M/ Q* T4 Y$ h! H6 S
键入标题。作为Block块的标题。7 N! ~5 B  ~/ K: @! J% p
3 ~7 g: M+ U9 p. T  k
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.+ \9 O( r) @% n! ^3 y- ]
在您想要显示的块节点上键入一个数字值。如果你愿意,你可以用1 (数字1) 。( [% \) E7 v; Y

3 F3 X( `+ K- R6 i- F
- u7 K& V/ ^& u6 f! }& ]+ |# D8 T8.click the "Fields" section heading to get its settings.
6 Y8 I6 Z* F  l1 r单击“Fields字段”部分的标题,以获得其设置。
! H, p% ]6 v0 R+ T7 Y3 _$ y  E8 c, \. O, ^1 c
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.) v1 D' W# x5 r
添加你想要的Fields领域。我只是选择“Node: Title节点:标题 ”因为我想只是链接到的节点,而不是节点的文本本身。你应该能够选择任何领域有报价在CCK的节点。
) V  s  P% `1 U+ _2 h# N* |  @# u( m1 D) `2 _
10.click the "Filters" section heading to get its settings." s; ~2 l' u' C/ H/ d2 }# P
点击“Filters过滤器”一节的标题,以获得其设置。7 X0 p4 u' }7 w
0 t- O$ p8 T' T4 c& U" O
11.select "Node: Type" and click "Add Filter"
7 }8 y8 P, f- r4 A! l8 |0 D7 d6 ~0 t选择“Node:Type节点类型” ,然后点击“添加Filter过滤器”
% F& S. w  s$ i* q& m/ E
( w: O+ H  g- v4 w5 A: J; T' L12.choose the CCK node type(s) you want to appear in the block.9 K: m8 R4 ^: P! G4 U
选择了CCK节点类型type(S)你要出现在块。
9 h9 o) L4 P: Q$ g3 N  v7 Q
& Z+ B$ e7 p& _. R. @$ R13.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.
+ O: F# Q$ }3 H, h3 ]选择“Node:Published节点:发布” ,点击“添加过滤器Filter”。(我一直忘了这一个,但它是重要的,因为你可能不希望显示未发表的节点。% Q1 H8 z2 B2 A* X7 E* h' x/ J4 O

; j/ p/ P' y$ M14.click the "Sort criteria" section heading to get its settings.
' R3 S: d- Z1 p7 Y! p6 _4 c) I点击“Sort criteria排序标准”部分的标题,以获得其设置。: ~. K- k7 U, J

" Y8 `* X8 o& }) d* c# M15.select "Random" and click "Add criteria".1 \0 O( d" Q0 b& j! n$ k
选择 "Random",点击 "Add criteria".
3 }( g8 M& |0 {( J# h: J- w. {: B
* F$ C3 o7 P, d6 u  V. i16.click "Save"1 [6 S3 y) I! b2 A. R* z) I1 q
点击保存. ]. ?+ j. K" x+ s

/ b0 q5 N3 i# C1 ^- c1 D. l17.click administer » blocks and enable the block you titled in step #6.
# m4 ?4 E  d7 y$ d, J9 G: i6 _点击administer » blocks,并启用第6步设置标题的Block快。
5 B) H" |: S0 `9 P" ]/ l7 N7 J- |( u
----------------------------------------------------------------------------------------------
7 L5 o" H3 u% I( c% v; O4 t0 c* l# D7 n5 l& Q, W" O% Y/ k
DOOOOR国外设计论坛 www.doooor.com---Howfar翻译!转载请注明,谢谢!
" c9 Y7 c0 o/ A: o7 f: N/ X* _8 B
* n5 L( z/ H3 J0 W% f* B8 L
4 K& M1 w+ X3 r8 d
6 J+ B' V: U0 ]$ P9 F6 s% i

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

GMT+8, 11-15-2025 00:42 , Processed in 0.181638 second(s), 51 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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