在Drupal 6中为每个定义的分类术语选择最新的节点 [英] Select the latest node for each defined taxonomy term in Drupal 6

查看:117
本文介绍了在Drupal 6中为每个定义的分类术语选择最新的节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以通过查询来显示Drupal 6中每个分类的1个节点?



例如,我有4个分类术语(tid = 21, 22,23,24)1个词汇(vid = 3)。



我想显示一个表:



分类术语:


  1. 分类学

  2. 描述

  3. 分类术语中的节点数量

  4. 分类术语中最新节点的标题

  5. 上次评论/更新日期

谢谢,
JK

解决方案

,只需使用 http://drupal.org/project/views =)您不需要任何钩子等等。



如果您需要在自定义模块中输出此视图,您可以执行以下操作:
创建视图,然后以编程方式调用:

  $ view = views_get_view('view_name'); 
$ view-> set_arguments(array($ order-> products [0] - > nid)); //传递参数以查看,如果需要
return $ view-> render('Defaults'); //返回呈现视图

  $视图 - >执行(); 

此后,您可以在$ view-> result变量中访问没有HTML输出的行数据。 p>

希望这有帮助。


Can anyone help me out with a query to display 1 node for each taxonomy in Drupal 6?

For example, I have 4 taxonomy terms (tid = 21, 22, 23, 24) in a 1 vocabulary (vid = 3).

I would like to display a table showing:

Taxonomy Term:

  1. Taxonomy
  2. Description
  3. Number of Nodes in Taxonomy Term
  4. Title of latest node in taxonomy term
  5. Last Commented/Updated Date

Thanks, JK

解决方案

Actually, just use http://drupal.org/project/views =) You don't need any hooks, etc.

and if you need to output this view in your custom module or whatever, you can do the following: create view, then call it programmatically:

  $view = views_get_view('view_name');
  $view->set_arguments(array($order->products[0]->nid)); // pass arguments to view, if it is required
  return $view->render('Defaults'); //return rendered view

OR

$view->execute();

After this, you can access rows data without HTML output in $view->result variable.

Hope this helps.

这篇关于在Drupal 6中为每个定义的分类术语选择最新的节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆