Drupal:使用参数的动态视图

发布于 2024-09-26 04:10:19 字数 636 浏览 7 评论 0原文

对于当前的项目,我需要设置一个特定的视图来显示图库详细信息页面。它应该像这样工作:

1. User clicked a node (costum-post-type: gallery)
2. User received an overview page with linked images
3. User clicked an image
4. User received the gallery page (gallerific view)

步骤 1-3 已完成。但是如何让 Drupal 使用概览页面的数据构建详细信息页面呢?

例如,如下所示:http://example.com/gallery-1/detailhttp://example.com/gallery-2/detail

/gallery-n 是带有链接图像的概览页面,detail/gallery-n 的详细信息页面。

希望你能明白我的意思?!

编辑

在概述页面上,我有一堆缩略图,每个缩略图都链接到详细信息库(jquery galleriffic)页面。

For a current project i need to setup a specific view to display a gallery detailpage. It should work like this:

1. User clicked a node (costum-post-type: gallery)
2. User received an overview page with linked images
3. User clicked an image
4. User received the gallery page (gallerific view)

Step 1-3 are done. But how can I get Drupal to build a detail page using the data of the overview page?

For Example something like this: http://example.com/gallery-1/detail or http://example.com/gallery-2/detail.

/gallery-n is the overview page with linked images and detail is the detailpage of /gallery-n.

Hope you'll understand what i mean?!

EDIT

On the overview page i have a bunch of thumbails which each are linked to the detail gallery (jquery galleriffic) page.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

似狗非友 2024-10-03 04:10:19

如果我正确理解你的问题,你应该做这些事情。

 1. Create view1 for page with linked images. It should be page display with http://example.com/images/%nid
   where %nid is nid argument of gallery. 
 2. Create view2 for gallery detailed page. it should be page display with http://example.com/%nid/detail 
 3. Theme that views as you want.
 4. For view1 for image field use override output in field settings to make it links to %nid/detail

PS 在需要时使用关系。如果描述不清楚,请填写询问。

If I'm correct understand your problem you should do this things.

 1. Create view1 for page with linked images. It should be page display with http://example.com/images/%nid
   where %nid is nid argument of gallery. 
 2. Create view2 for gallery detailed page. it should be page display with http://example.com/%nid/detail 
 3. Theme that views as you want.
 4. For view1 for image field use override output in field settings to make it links to %nid/detail

P.S. Use relationships where needed. If description is not clear, fill free to ask.

極樂鬼 2024-10-03 04:10:19

您可以在您制作的(或可能已经拥有的)自定义模块中尝试类似的操作:
您可以在菜单中设置所需页面的路径,并将其设置为调用函数的回调,然后您可以呈现您想要的任何内容,或调用您想要的任何内容。

function MODULENAME_menu() {
  $items = array();
  $items['gallery/%/detail'] = array(
    'title' => 'Gallery Detail',
    'page callback' => 'MODULENAME_gallery_detail_page',
    'page arguments' => array(1),
    'access callback' => TRUE,
    'type' => MENU_CALLBACK
  );
  return $items;
}

function MODULENAME_gallery_detail_page($gallery_id) {
  // Here you can render the view as a page, using the gallery
  // id which you passed as a parameter to this function.
  // So Change MYCUSTOMVIEW to the view you want to render
  $view = views_get_view('MYCUSTOMVIEW');
  print views_build_view('page', $view, array(), false, false);
}

只需将 MODULENAME 更改为您的模块名称即可。在调用views_build_view时,您可能需要做一些工作,但这应该是一个开始,如果您愿意,您可以提出更多问题,我会提供帮助。

You can try something like this, in a custom module you make (or maybe already have):
where you set the path to the page you want in the menu and set it as a callback that calls a function and then you can render whatever you want, or call whatever you want.

function MODULENAME_menu() {
  $items = array();
  $items['gallery/%/detail'] = array(
    'title' => 'Gallery Detail',
    'page callback' => 'MODULENAME_gallery_detail_page',
    'page arguments' => array(1),
    'access callback' => TRUE,
    'type' => MENU_CALLBACK
  );
  return $items;
}

function MODULENAME_gallery_detail_page($gallery_id) {
  // Here you can render the view as a page, using the gallery
  // id which you passed as a parameter to this function.
  // So Change MYCUSTOMVIEW to the view you want to render
  $view = views_get_view('MYCUSTOMVIEW');
  print views_build_view('page', $view, array(), false, false);
}

Just change MODULENAME with the name of your module. You might need to do some work when calling the views_build_view, but it should be a start, you can ask some more questions if you like and I'll help out.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文