I always found it difficult to work with template suggestions in Drupal. I'm trying to override those files (html.tpl.php, page.tpl.php, region.tpl.php) for a given url (mysite.com/user-export). So I found this function:
function MYTHEMENAME_process_page(&$variables) {
if (module_exists('path')) {
$alias = drupal_get_path_alias(str_replace('/edit', '', $_GET['q']));
if ($alias != $_GET['q']) {
$template_filename = 'page';
foreach (explode('/', $alias) as $path_part) {
$template_filename = $template_filename . '__' . $path_part;
}
$vars['theme_hook_suggestions'][] = $template_filename;
}
}
}
That seemed to work pretty well, I created a file named page--user-export.tpl.php to override the page.tpl.php file and it worked. However, at some point I removed that function, and the template overriding was still working! So I guess in some cases we need to create a function in template.php, and in some other cases, the overriding is done automatically without having to create a function.
So my question is: When to use template suggestions ?
Thanks in advance!