By v1nce on
I need to show a different taxonomy/term/id page depending on what term/id is being loaded. In my example, I want the taxonomy/term/id page to only show the node thumbnail if the term/id is from a certain content type. In order to accomplish this, I have manually hard coded the taxonomy_render_nodes function located in taxonomy.module.
Is there a better way to do this? Perhaps overriding somehow within the template.php or creating a module?
Comments
Let's see if I understand correctly
It sound like you want one or more content types to display differently when displayed on pages of the form taxonomy/term/id.
You could either modify node.tpl.php if it applies to all content types or if just some content types make a node-{content type}.tpl.php file and modify those templates. In general one solution would be to modify them something like this
Modifying the node-{content
Modifying the node-{content type}.tpl.php file does not modify how the taxonomy/term/xx page displays. The node object is being loaded within the taxonomy_render_nodes() function and then loaded with node_view().
I am having to create a sql query to pull all the taxonomy term id's of one content type, then check if the current taxonomy/term/xx page is one of these term id's. If so, we display the image thumbnail only. Here is my taxonomy_render_nodes() modified code from the taxonomy.module:
What is the correct Drupal way to modify this code?
-----------------------------------------------------------------
Petafoo - We Love Animals
Calling node_view invokes the approriate tpl.php file
Calling node_view invokes the approriate tpl.php file so one can add a test there that does different formatting based on path. Similiar to what you have but it moves the logic into the tpl.php file
Ahhhh, ok. I was loading the
Ahhhh, ok. I was loading the node object without node_view() if the page was on a taxonomy/term/xx within the sql query result. So, when I was editing the node-{content-type}.tpl.php file and not seeing any changes this was throwing me off.
Editing the node-{content-type}.tpl.php file works perfectly. Thank you nevets!
-----------------------------------------------------------------
Petafoo - We Love Animals
Possible solution
This seems to work: http://drupal.org/node/67548
What really bothers me though is that I do not understand what processes URLs like taxonomy/term/1 - it seems like (at least in my installation) it is NOT taxonomy_term_page($term) in taxonomy module (I even tried deleting the function completely to make sure - nothing changes).
It is a mystery.
A>
Just to be of help if I can
Just to be of help if I can be, I know this code works in a template
but does it work within the render function?
I want a solution for this, because I hate the Catalog module. Catalog makes the product nodes appear in a nice table layout, but it doesn't overwrite the taxonomy page, so you have extra pages to worry about. Also, Catalog messes up PathAuto, because both Catalog and Taxonomy pages share the same alias, making it append a zero (0). I just want to have a nice table grid for nodes of a specific term id or vocabulary... or node type, whichever is easier.
---
I have created and maintained countless Drupal-powered sites and have made heavy modifications to modules on a site-by-site basis. I am an illustrator, a game developer, and a web developer. I also stream on Twitch in my spare time.
You could use views, in
You could use views, in Drupal 5 (views 1) there is an extra module that provides a grid, in Drupal 6, views 2 comes with a grid style. Since you can override the default taxonomy terms with views this could meet your needs.