根据节点标题生成辅助菜单 [英] Generating secondary menu based on node titles

查看:126
本文介绍了根据节点标题生成辅助菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想根据所有节点的第一个字母生成一个具有某种内容类型的辅助菜单,但是我不知道该怎么做。

I would like to generate a secondary menu based on the first letter of all of my nodes that have a certain content-type, however I am unsure how to go about doing this.

基本上,我将生成所有节点的字母顺序列表(对于给定的内容类型)。

Basically, I will be generating an alphabetical list of all nodes that I have (for a given content-type).

例如,我想要让我的二级菜单生成AZ,但只有与相关联的节点的字母将是活动的。

For instance, I would like to have my secondary menu generate A-Z, however only the letters with an associated node would be active.

所以,如果我有节点:苹果,葡萄,芒果,梨,那么我的菜单将如下所示:

So, if I had nodes: apple, grapes, mango, pear, then my menu would look like this:

a bcdef g hijkl m p qrstuvwxyz

a b c d e f g h i j k l m n o p q r s t u v w x y z

粗体字母为活动链接,其余为无效。

with the bolded letters being active links, and the rest disabled.

编辑

好的,过去几天没有回应

ok, no responses in the past few days

而是删除二级菜单要求,只需生成一个fir的列表给定内容类型中的所有节点的st字母?

how, instead, removing the 'secondary menu' requirement and simply generating a list of the first letters of all the nodes within a given content-type?

推荐答案

创建包含所有这些节点的视图。然后得到自定义寻呼机模块(也需要令牌),它应该让你放在一起。

Create a view containing all those nodes. Then get the custom-pager module (also requires token), it should let you put together something.

您可以在模板文件夹中创建一个custom-pager.tpl.php,并从视图中检索节点列表。我认为它被称为 $ nav_array ,但请查看自定义寻呼机文档。

You create a custom-pager.tpl.php in your templates folder, and you'd retrieve the list of nodes from the view. I think it's called $nav_array but look at the custom-pager documentation.

然后可以按照他们的名字和创建你的az列表。将需要一些PHP编码。

You can then just sort nodes by their names and create your a-z list. Will require a bit of PHP coding.

这些可能有助于...

These might help...

http://drupal.org/node/114248

http://www.lullabot.com/articles/custom-paging-for-views

这篇关于根据节点标题生成辅助菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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