I want to show a modal popup in drupal 7. On searching the web I came to know that it can be done using the ctools module itself. Here is the code I tried:
function codeexpertz_menu() {
$items['codeexpertz/%ctools_js/page'] = array(
'title' => 'Demo CTools Page',
'access callback' => TRUE,
'page callback' => 'codeexpertz_ctools_page_example',
'page arguments' => array(1),
'type' => MENU_CALLBACK,
);
return $items;
}
function codeexpertz_ctools_page_example($js) {
$output = "Sample CTools popup functionality for Demo purpose.";
if ($js) {
// Required includes for ctools to work:
ctools_include('modal');
ctools_include('ajax');
return ctools_modal_render("Demo", $output);
}
return $output;
}
The link i referred is here
I added <a href="codeexpertz/nojs/page" class="ctools-use-modal">Modal Window</a>
to my page.tpl.php
file directly for now to test it. However when I click on the link I get redirected on the destination page rather than showing the content in a modal.
I tried this is a fresh installation also, but all in vain.