I'm working in Drupal 7, and trying to render a map & construct a list based off of content in a certain taxonomy. For example:
- Various locations are created as individual nodes, with information (title, location, phone number, hours, etc.) attached.
- One field in the location nodes is a taxonomy term: market. For example, East Coast or West Coast.
Currently, the only location this map exists is on a taxonomy-term--markets template, which pulls in all variables about each location in the appropriate market.
What I want to do is display a map on a different page (node--page) by selecting the market manually as a related field type. I can get the market name to appear, but I cannot get any information about the child locations! How do I do this? I've tried using a view and a block, but the template for the map is quite involved — and my understanding (which could be wrong) is that the variables I need to access cannot be "templated" from within the view/block system.
Anybody know how to go about accessing node information for a given taxonomy on a page template? Thanks!
Your map exists currently on
taxonomy-term--marketswhich is I believe a taxonomy term template level rather than a page template level. By default the taxonomy page will be displaying the list of node that relate thattidterm. On yourtemplate.phpfile add a taxonomy template preprocess functionThe
$nodeswill give you a list ofnids which you cannode_loadfrom them, will give you access to node info.On
page--node--pagetemplate level if you know the taxonomy term{tid}than you can create a page preprocess function. So on your {your_theme}/template.phpAnd on your
page--node--pagetemplate output it by