WordPress有个插件(Random Articles WordPress Plugin)可以实现随机文章区块。Drupal好像没有随机文章(Random Articles)模块,那么Drupal怎么实现随机文章区块呢?
其实很简单,用View就可以实现随机文章。只要在Sort Criteria里面选择添加 Global: Random排序条件即可。
WordPress有个插件(Random Articles WordPress Plugin)可以实现随机文章区块。Drupal好像没有随机文章(Random Articles)模块,那么Drupal怎么实现随机文章区块呢?
其实很简单,用View就可以实现随机文章。只要在Sort Criteria里面选择添加 Global: Random排序条件即可。
下面就是随机排序设置的截图:
Drupal Ramdon Articles 设置步骤:
- create a new view in administer » views » add tab.
- give it a name. I called mine "Random".
- click the "Block" section heading to get its settings.
- enable "Provide block"
- choose a "View type". I went with "List View" so that I could choose which fields display in the block.
- type in a title. This will be the title of the block.
- 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.
- click the "Fields" section heading to get its settings.
- 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.
- click the "Filters" section heading to get its settings.
- select "Node: Type" and click "Add Filter"
- choose the CCK node type(s) you want to appear in the block.
- 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.
- click the "Sort criteria" section heading to get its settings.
- select "Random" and click "Add criteria".
- click "Save"
- click administer » blocks and enable the block you titled in step #6.