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).
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 n开发者_运维问答odes: apple, grapes, mango, pear, then my menu would look like this:
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.
edit
ok, no responses in the past few days
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.
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.
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
精彩评论