Experimenting with the Views module I set up a view for /taxonomy/term with 1 argument of 'term id'. This appeared to overwrite the default output of /taxonomy/term/n (i.e. I saw my new view page, and not the usual /taxonomy/term/n page).

Is this intended (and thus stable) behaviour, or just accidental? In other words, is it something I could use in a site, or might a future version of Views or Drupal change something so that the taxonomy.module implementation of /taxonomy/term/n would take precedence over my views.module implementation?

Thanks, James Harvard

Comments

Gman’s picture

I am sure an expert will come along and give a better explanation, but I am pretty sure this is the intented function.

The views module was written to display custom ways of viewing content, at the paths set in the module. They are intented to supercede the default way of displaying items (like the normal taxonomy displays).

I am sure hoping this behavior is not depreciated in the future as I am designing my site on the stability of the views module rendering such paths.

-Gman

James Harvard’s picture

Forgot to mention that the admin/views page says something about overriding system views:

Below are system default views; if you edit one of these, a view will be created that will override any system use of the view.

However after reading that it still wasn't 100% clear to me that views.module is designed to override any system view with the same path, or just the ones listed on the Views admin page.

pete@fiddley.com’s picture

Am I crazy here? I also setup a view with a URL "taxonomy/term". When I hit /taxonomy/term/n I still get the default taxonomy view provided by the system rather than my custom view.

ANyone have any thoughts to point me in the right direction?

James Harvard’s picture

Maybe a caching issue? Try accessing the page as a different user (IIRC caching is done 'per user').

pete@fiddley.com’s picture

merlinofchaos responded to an email offline:

It probably has to do with module weight. In the system table give views
a weight of 10.

I made the change and it worked. Not sure why this isn't the default case when the module installs though.

drurian’s picture

When I create a new taxonomy/term view it overrides views for all vocabularies but I need it only for one and keep the default view for the rest. Anyone knows how to restrict this view to a specific vocabulary?

summit’s picture

Hi,

Could the taxonomy_redirect module help you?

greetings,
Martijn

chadchandler’s picture

I have the same problem but found the solution. Due to the issue mentioned here http://drupal.org/node/124847 I can fix the problem by changing 'taxonomy/term/' to taxonomy_term_path($term) in the source code of the module that incorrectly show redirected link. The problem is not in the taxonomy redirect module.

For example I needed to change all taxonomy term link in a vocabulary from taxonomy/term/TERMID to faq/TERMID and Display all term in that vocabulary by using taxonomy list. I went to taxonomy_list.module and changed line 266 which has hard code 'taxonomy/term' . $term->tid so you can see that it will never change to what I want (faq/TERMID). If you want to make it call to hook method defined in taxonomy_redirect.module, then you have to change it to taxonomy_term_path($term).

salvatoreco’s picture

Hi, I've this issue for you folks: I'm doing a Flickr-like site using Drupal 5.3. I've installed these modules: Views, CCK, Imagefield for CCK, Imagecache, Pathauto and Token.
Well, after I made new content type (photo entry) with CCK + Imagefield (using imagecache, too), I've done a new vocabulary for photo's tags, then I've assigned new url alias with pathauto and token like this:

  • Pattern for all Photo paths: photo/[user]/[nid]
  • Pattern for all Photo tags paths: photo/tags/[catpath]


Then I've made a new View for viewing all photos linked to a specific tag using the path photo/tags/#name-of-tag. This is the export of that view:

$view = new stdClass();
  $view->name = 'foto_tags_view';
  $view->description = 'Visualizza le foto associate a un tag';
  $view->access = array (
);
  $view->view_args_php = '';
  $view->page = TRUE;
  $view->page_title = 'Foto per il tag "%1"';
  $view->page_header = '';
  $view->page_header_format = '1';
  $view->page_footer = '<div id="bot_views_foto"><h4>Sfoglia per tag</h4><?php
  $vid = 1;         /* <---- put correct vocabulary ID here */
  /* $show_pic = module_exists(\'taxonomy_image\'); */
  echo \'<div class="tag_cloud_foto">\';
  $terms = taxonomy_get_tree($vid);
  /* while (list($count, $term) = taxonomy_term_count_nodes($term->tid)) $terms[$term] = $count;
  $massimo = max($terms);
  $minimo = min($terms);
  $distribution = ($max - $min) / 5; */
  
    foreach ($terms as $term) {
		$count = taxonomy_term_count_nodes($term->tid);
		
		$massimo = max($terms);
		$minimo = min($terms);
		$distribution = ($massimo - $minimo) / 5;
		
		if ($count == $minimo) {
			$tag_class = "moltopiccolo";
		}
		elseif ($count == $massimo) {
			$tag_class = "enorme";
		}
		elseif ($count > ($minimo + ($distribution * 2))) {
			$tag_class = "grande";
		}
		elseif ($count > ($minimo + $distribution)) {
			$tag_class = "medio";
		}
		else {
			$tag_class = "piccolo";
		}
	
		echo \'<span class="\'.$tag_class.\'">\' .l($term->name,\'photo/tags/\'.$term->name, NULL, NULL, NULL, NULL, TRUE).\'</span>\';
   } /* end foreach */
  echo \'</div>\';
?>
</div>';
  $view->page_footer_format = '2';
  $view->page_empty = '';
  $view->page_empty_format = '1';
  $view->page_type = 'list';
  $view->url = 'foto/tags';
  $view->use_pager = TRUE;
  $view->nodes_per_page = '24';
  $view->sort = array (
    array (
      'tablename' => 'node',
      'field' => 'created',
      'sortorder' => 'DESC',
      'options' => 'normal',
    ),
  );
  $view->argument = array (
    array (
      'type' => 'taxletter',
      'argdefault' => '1',
      'title' => '%1',
      'options' => '0',
      'wildcard' => '',
      'wildcard_substitution' => '',
    ),
    array (
      'type' => 'node_feed',
      'argdefault' => '2',
      'title' => '',
      'options' => '',
      'wildcard' => '',
      'wildcard_substitution' => '',
    ),
  );
  $view->field = array (
    array (
      'tablename' => 'node_data_field_immagine_foto',
      'field' => 'field_immagine_foto_fid',
      'label' => '',
      'handler' => 'content_views_field_handler_ungroup',
      'options' => 'foto-thumb_linked',
    ),
    array (
      'tablename' => 'term_node_2',
      'field' => 'name',
      'label' => '',
      'options' => 'link',
    ),
  );
  $view->filter = array (
    array (
      'tablename' => 'node',
      'field' => 'status',
      'operator' => '=',
      'options' => '',
      'value' => '1',
    ),
    array (
      'tablename' => 'node',
      'field' => 'type',
      'operator' => 'OR',
      'options' => '',
      'value' => array (
  0 => 'foto_entry',
),
    ),
  );
  $view->exposed_filter = array (
  );
  $view->requires = array(node, node_data_field_immagine_foto, term_node_2);
  $views[$view->name] = $view;

Well, if I go to photo/tags/#name-of-a-tag Drupal returnes to me the taxonomy page list instead of the view I've made.
Is there a way to override taxonomy path with custom view path?