Anniekin Posted September 28, 2008 Share Posted September 28, 2008 I am trying to override the urls that taxonomy_menu produce. It changes urls such as drupalSite.com/forum/17 with a 'category' urls such as drupalSite.com/1/2/17 I want to switch 'category' with 'forum' in the path and strip the 1/2/ so that the output matches the original url again. Thank you for your insight. [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/126118-drupal-taxonomy_menu-module-patch/ Share on other sites More sharing options...
Anniekin Posted September 28, 2008 Author Share Posted September 28, 2008 This is the code I have been focusing my efforts on: function _taxonomy_menu_menu() { $items['admin/settings/taxonomy_menu'] = array( 'access arguments' => array('administer site configuration'), 'description' => t('Global configuration of taxonomy menu functionality.'), 'file' => 'taxonomy_menu.inc', 'page callback' => 'drupal_get_form', 'page arguments' => array('_taxonomy_menu_admin'), 'path' => 'admin/settings/taxonomy_menu', 'title' => t('Taxonomy Menu settings'), 'type' => MENU_NORMAL_ITEM ); foreach (taxonomy_get_vocabularies() as $vocab) { if (variable_get('taxonomy_menu_show_'. $vocab->vid, TAXONOMY_MENU_NONE)) { $path = variable_get('taxonomy_menu_display_page', 'category') .'/'. $vocab->vid; $items[$path] = array( 'access arguments' => array('access content'), 'file' => 'taxonomy_menu.inc', 'page callback' => '_taxonomy_menu_page', 'title' => t($vocab->name), 'weight' => $vocab->weight ); $tree = taxonomy_get_tree($vocab->vid); $old_depth = -1; $old_path = $path; foreach ($tree as $term) { if ($term->depth <= $old_depth) { $slashes_to_remove = $old_depth - $term->depth + 1; for ($i = 0; $i < $slashes_to_remove; $i++) { $old_path = substr($old_path, 0, strrpos($old_path, '/')); } } $path = $old_path .'/'. $term->tid; $old_depth = $term->depth; $old_path = $path; $num = taxonomy_term_count_nodes($term->tid); if (variable_get('taxonomy_menu_hide_empty', FALSE) == FALSE or $num != 0) { $name = t($term->name); if (variable_get('taxonomy_menu_display_num', FALSE) == TRUE) { $name .= ' ('. $num .')'; } $items[$path] = array( 'access arguments' => array('access content'), 'file' => 'taxonomy_menu.inc', 'page callback' => '_taxonomy_menu_page', 'description' => t($term->description), 'title' => $name, 'weight' => $term->weight, ); } } } } return $items; } Quote Link to comment https://forums.phpfreaks.com/topic/126118-drupal-taxonomy_menu-module-patch/#findComment-652161 Share on other sites More sharing options...
Anniekin Posted September 28, 2008 Author Share Posted September 28, 2008 If this is beyond the scope of this forum I apologize. Quote Link to comment https://forums.phpfreaks.com/topic/126118-drupal-taxonomy_menu-module-patch/#findComment-652561 Share on other sites More sharing options...
Ivaked Posted September 30, 2008 Share Posted September 30, 2008 Admin > Site Building > Modules Enable the 'Path' Module. When creating, editing or whatever to a page/story/comment etc, scroll to URL Path Settings and adjust accordingly to whatever you want. I'm not sure if this is what you are looking for though, so I apologise if it is not. Either way I hope that helps. ~Liam Quote Link to comment https://forums.phpfreaks.com/topic/126118-drupal-taxonomy_menu-module-patch/#findComment-653713 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.