What's the programatic way to get image module gallery output?

mattyoung - October 17, 2008 - 18:05

I have three image galleries I want to show using local task tabs:

Tab1 show "/image/tid/2"
Tab2 show "/image/tid/3"
Tab3 show "/image/tid/4"

the solution I plan on using is define a module and in it define MENU_LOCAL_TASK menu like this:

function mypictures_menu() {
  $items['mypictures'] = array(
    'title'  =>  'View my special pictures',
    'type' => MENU_NORMAL_ITEM,
  );

  $items['mypictures/AAAA'] = array(
    'title' => 'Gallery AAAA',
    'page callback' => 'mypictures_show_gallery',
    'page arguments' => array('2'),
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => 0,
  );

  $items['mypictures/BBBB'] = array(
    'title' => 'Gallery BBBB',
    'page callback' => 'mypictures_show_gallery',
    'page arguments' => array('3'),
    'type' => MENU_LOCAL_TASK,
    'weight' => 1,
  );

  $items['mypictures/CCCC'] = array(
    'title' => 'Gallery CCCC',
    'page callback' => 'mypictures_show_gallery',
    'page arguments' => array('4'),
    'type' => MENU_LOCAL_TASK,
    'weight' => 2,
  );

  return $items;
}


function mypictures_show_gallery($id) {
  $output = '<p>My very special picture, click on thumbnail to see large size, click on caption to see details.</p>';
 


  $output .= GET_ME_THE_OUTPUT_OF_IMAGE_GALLERY('image/tid/' . $id); // <<<=== what is this ?



  return $output;

}

1. is my solution the right one?
2. what is the function 'GET_ME_THE_OUTPUT_OF_IMAGE_GALLERY' to get the image gallery output?
3. I have thickbox enable on image gallery, will it still work this way?

tease.

dman - October 17, 2008 - 18:44

Interesting approach. Using a module to handle specific content (and those hard-coded numbers) is not exactly portable, but hey, it's your module, and it looks like it'll actually get your job done, so it's all fun.

Anyway ... to answer your question,
Or not really, but to show you how the question could be answered,
... how does image_gallery do it? :-B

image/contrib/image_gallery/image_gallery.module:20

<?php
function image_gallery_menu() {
 
$items = array();

 
$items['image'] = array(
   
'title' => 'Image galleries',
   
'access arguments' => array('access content'),
   
'type' => MENU_SUGGESTED_ITEM,
   
'page callback' => 'image_gallery_page',
  );
?>

Y'know, I think you might just be able to skip your own mypictures_show_gallery() altogether!

Note that image_gallery_page() expects two arguments...

I touched on the procedure for module autopsy in the troubleshooting guide point 9, the same method applies here.

.dan.
if you are asking a question you think should be documented, please provide a link to the handbook where you think the answer should be found.
| http://www.coders.co.nz/ |

Thank you!

mattyoung - October 17, 2008 - 19:05

I didn't look in the contrib dir that's why I couldn't find the code. Now I know where else to look. Thanks!

 
 

Drupal is a registered trademark of Dries Buytaert.