I currently have a page which has a block with taxonomy terms displayed. Each link has been made to work with ajax to display information below if clicked, generated in a module callback.
What I am trying to acheive is also have this work if linked to. So for example my page URL is currently http://localhost/events/building01 If someone was to visit http://localhost/events/building01/printer then the information for printer would be displayed under the taxonomy term as it would if someone had clicked on the term.
My ajax links are currently setup like:
function building_block_menu()
{
$items['events/%/%/ajax'] = array(
'title' => 'ajax call',
'page arguments' => array(1, 2),
'page callback' => '_event_ajax_callback',
'access arguments' => array('access content'),
'type' => MENU_CALLBACK,
);
$items['events/%/%/nojs'] = array(
'title' => 'nojs call',
'page arguments' => array(1, 2),
'page callback' => '_event_nojs_callback',
'access arguments' => array('access content'),
'type' => MENU_CALLBACK,
);
return $items;
}
function _event_ajax_callback($building, $type)
{
$markup = $building . ' - ' . $type;
$ajax_commands = array();
$ajax_commands[] = ajax_command_html('#ajax-target', $markup);
ajax_deliver(array('#type' => 'ajax', '#commands' => $ajax_commands));
}
function _event_nojs_callback()
{
return "no js to be built";
}
And called from links built like:
$output .= l($term->name, 'events/$building/'.$term->tid.'/nojs', array(
'attributes' => array('id' => 'building-term-'.$term->tid, 'class' => 'use-ajax')
));