dpd3447 2013-09-29 22:29
浏览 25
已采纳

Drupal 7节点引用“查询”

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条回答 默认 最新

  • dongpanshi2839 2013-10-05 09:26
    关注

    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
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮