views:

87

answers:

2

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.

+1  A: 

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.

zeroFiG
I forgot to mention that I changed the path a bit from /gallery-N/detail to gallery/N/detail so that I could extract the number, hope that's not too much of a problem, otherwise can walk around it
zeroFiG
Thank you for your suggestion. I'll try it :)
gearsdigital
I'm not sure if i understand you correctly. I have to build my own module?
gearsdigital
+1  A: 

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.

Igor Rodinov
Are you sure that works? Because the first argument (`http://example.com/%nid/detail`) of a url can't be a dynamic imho.
gearsdigital
Sure. why it can not be? go to view edit page, select image field to edit, check Output this field as a link and you will see text fields that used for that link, under that fields you can find placeholders of arguments and ther fields. use them.
Igor Rodinov
That does not work for me. Drupal says to me: "%" may not be used for the first segment of a path.
gearsdigital
Yes you are right. % can not be first segment. I had error in description. I'm so sorry. But anyway this works. You just need to use such path http://example.com/image/%nid/detail or if there would be conflicts with view1 use http://example.com/images_detail/%nid/detail and check this module for views aliases http://drupal.org/project/view_alias it could be usefull for you.
Igor Rodinov