سؤال

I have a content type called services_list_page that is used to create a landing page that people can then use to navigate to child pages using the content type service_details. The relationship between these pages is only defined by a menu and no where else currently.

Program Service (services_list_page)
-- Cat1: (not a page, just a category type thing in menu)
  -- child 1 (service_details)
  -- child 2 (service_details)
-- Cat2
  -- child 3
  -- child4
  -- and so on..

I need to have these child pages not only listed in the menu but also dynamically within the content in lists (ul li) one list per child page "category". I have overridden the node template file for these content types. What would the best way to do this with either a module or some code within the template file to pull this data dynamically?

هل كانت مفيدة؟

المحلول 2

Found an easy solution So at first I found a way to get by but it was messy and the in page menus did not get updated when the left nav sub menu was updated. Then I found the menu block module.

  • Install Menu Block Module https://drupal.org/project/Menu_Block
  • add new menu block, configure as needed. starting level set to second level
  • Add the following code to template file to invoke the menu block

You can get the number, in here its 1, from the url when you click configure for the menu block on the block page, so admin/structure/block/manage/menu_block/1/configure becomes:

$block = module_invoke('menu_block', 'block_view', '1');
print render($block['content']);
  • Optional Create template for the menu by creating template file "menu-block-wrapper--1.tpl.php". you can get the menu data by looping through the array called $content

نصائح أخرى

you can define your custom page in hook_menu() and print whatever content and links to child nodes you want.

here is an example (slovak) of how I did it, its an newspaper archive http://hnonline.sk/archiv http://hnonline.sk/archiv/2013/10/3

if you need furher help, just ask

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top