Return to Snippet

Revision: 49531
at July 24, 2011 07:04 by woutr_be

Initial Code
function template_preprocess_node(&$variables) {
	if(isset($variables['node']) && $variables['type'] == "page") {
		$path = drupal_get_path_alias($variables['path']);
		$variables['theme_hook_suggestions'][] = 'node__page_' . $path;

Initial URL

Initial Description
This will give you the ability to create custom node templates based on the URL alias of a page.

Example: if you create a page with the URL alias "aboutus", you can now use node--page-aboutus.tpl.php as your node template.

Initial Title
Drupal 7: custom template based on url alias

Initial Tags

Initial Language