By damd on
I'm trying to use a different page template if the request URI matches a regular expression. I've read guides and manuals all over the place but nothing seems to help.
function my_theme_name_preprocess_page(&$vars) {
$curr_uri = check_plain(request_uri());
if (preg_match("/\?shadowbox=1$/", $curr_uri) && module_exists('shadowbox')) {
$vars['theme_hook_suggestions'][] = 'shadowbox';
dpm("Using Shadowbox");
kpr($vars);
}
}The dpm and kpr calls are being made but it's not using templates/shadowbox.tpl.php for some reason. I have cleared the cache and everything, but still nothing.
Any ideas?
Comments
Bump. Any ideas?
Bump. Any ideas?
Sorry to bump this again, but
Sorry to bump this again, but if no one has a good answer to this, could it really be a Drupal 7 bug? Seems to me that I'm doing everything according to the documentation and all the other forum threads I've been able to find about the matter.
Finally, I have solved the
Finally, I have solved the problem. Apparently 'shadowbox' is not a valid name to override a page template. I changed it to 'page__shadowbox', created a template called 'page--shadowbox.tpl.php' and now it works fine.
Phew.