Drupal View (Page) vs Taxonomy
I use taxonomys (tx) as tags. They can be added when the node is created. So I don't know how many tx I have or what ID they have. The path of the tx is like the following:
/foo/element1
/foo/element2 /foo/element3 ...The secound element is the tx.
Now I wan开发者_开发问答t to use a view (page) to handle the tx-path:
/foo/%The problem is, when I open a path like the one on top I see the theme of the node-taxonomy.tpl.php but not the style I set in the view.
Whenever I open a path in the form (/foo/not-a-tx) I can see the output of the view.
Could someone give me a hint how to get out the view output but not the tx-output?
Thanks Sebastian
I solved the problem with this way:
- I use a view block (not a page)
- I added a new output area in my ,info file
- I use this way to show only the vocab
- I show the block in the new area online bei foo/*
It works Okay for me.
Thx to every one.
Do you want to get rid of the taxonomy pages completely?
If so, you can use a hook_menu_alter() and unset the taxonomy page.
EX.
hook_menu_alter(&$items) {
unset($items['taxonomy/term/%taxonomy_term']);
}
You'd have to look at the $items array to pinpoint the name of the registered menu path, but I think this is it.
This will remove the taxonomy page for all vocabularies however.
Actually you need to make a view to override the internal drupal path of the taxonomy term page: taxonomy/term/% (where % is the taxonomy id) and not the aliased path, which in your case is foo/%
[Optional but saves work: There is already an example view that is bundled with Drupal that implements the taxonomy view. Go to Views > List and you will see the the view is greyed out and it is called
Default Node view: taxonomy_term (default)
All you need to do is enable it and modify it to your needs]
Don't worry about the aliases. You can define your URL pattern at /admin/build/path/pathauto
(make sure pathauto module is enabled. You can download it at http://drupal.org/project/pathauto ). In your case the pattern would be foo/[cat]
where [cat]
is a token for category. Make sure you enter this pattern under Taxonomy Term paths
in the pathauto automated alias settings.
精彩评论