How to create a template for page created in drupal Admin with URL alias

By

December 11, 2012DrupalNo comments

Drupal theme layer gives us the flexibility to theme all the data used through out the site. We can also theme the page created from the drupal admin panel.

To Create a template for Basic Page Content type with URL alias follow the below steps.

Step 1: First create a page from drupal admin and give the URL alias. For this example i am creating a Page with “mytestpage” URL alias

Step 2: We need to implement hook_preprocess_page. Add the below code snippet in template.php file in your current theme folder (custom theme)

Step 3: Now create a new file called page–mytestpage.tpl.php (format page–aliasurl.tpl.php) and drop it in your theme folder.

Step 4: Now clear the performance cache to refresh the theme registry.

Now the custom template will be picked up by drupal theme registry. To check if it is working i have given inline style with red color in page–mytestpage.tpl.php.

Leave a Reply