0

I have created a custom menu with hook menu booking/%/reschedule and where % is nid of bookings ( content type ), I want to override tpl file for this page in my theme. I tried with page--booking--%--reschedule.tpl.php but its not working.

  • you want to override template for a specific content type.?? – Abin Oct 22 '15 at 9:06
  • Want to override tpl for this menu page not for content type – Vikram Oct 22 '15 at 9:11
  • Is would be the node id then booking--123--reschedule.tpl.php – Alex Gill Oct 22 '15 at 9:13
2

Write this function in your template.php file, which is located in your theme (untested):

function MYTHEME_preprocess_page(&$vars) {
  $alias_parts = explode('/', drupal_get_path_alias());

  if (count($alias_parts) && $alias_parts[0] == 'booking' && $alias_parts[2] == 'reschedule') {
    $vars['theme_hook_suggestions'][] = 'page__bookingtemplate';
  }
}

Then you can create a new template file which is called page--bookingtemplate.tpl.php and after clearing the cache, it should work.

Credits to Clive for this post.

| improve this answer | |
0

You can create a menu by adding code in your file

<?php
function THEMENAME_links__system_MENUNAME_menu($variables) {
  $output = '';
  foreach ($variables['links'] as $link) {
    $output .= l($link['title'], $link['href'], $link);
  }
  return $output;
}
?>
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.