0

I am building a site with the primary goal of capturing detailed information about different destinations around the world. What is the recommended site structure for something like this using drupal 7?

So far I envision: my nodes would be a custom location type with the location's details expanded out using fields. I would then replicate the location hierarchy into a hierarchical vocabulary (Continent > Country > City, etc.) so users could search for a specific location. Should the hierarchy be flat (one vocab for Countries, another for Cities, etc.)?

  • It's about half a year since the question was asked, so I assume we could ask you about the progress rather than comment on your visions. The hierarchy of the taxonomy is kind of obvious, but I certainly wouldn't fear Views as much as taxonomy search and search result display. This is where you might encounter problems. If you were to perform search through nodes as well as taxonomy terms, you might conclude that you can't go far without Apache Solr = Java-enabled host, VPS with SSH. I'd be curious to hear about your achievements in this project from that perspective. – Artur Jul 12 '12 at 7:51
  • See stackoverflow.com/questions/13089255/… – Adam Oct 28 '12 at 23:24
1

Think of Drupal as an interface to a database (it is one) and vocabularies, when used as the basis for fields associated with your content items, as a means for filtering for values in a table. If the terms in a hierarchy would have 1-to-many or many-to-many relationships, then you will want to have separate tables and therefore separate vocabularies so that you can use relationships to make selections. In your case, the relationship between continent-county-city is one-to-one (with occasional duplicates such as two cities with the same name) so a single vocabulary, using a hierarchy, makes more sense.

The Views module is basically a UI for queries to the database, so you will use Views to make selections from your table, and menus can be structured as hierarchies to present selections to users using the same multi-level logic of your location vocabulary. You may choose to create content by defining a new content type article that has a field attached to it associated with the location vocabulary and perhaps a second vocabulary to identify the type of information it contains. This second vocabulary would have terms such as geography, government, cuisine, hotels, restaurants, etc. When creating an article about hotels in Paris, you would label the two fields from the vocabularies so that the articles can be filtered accordingly. This is, in simple terms, how Drupal assembles sites.

  • Thanks for the clarification on vocabularies. If I use a hierarchy for a locations vocabulary, will I be able to allow users to filter for items from a lower level based on a higher level? In other words, if I specify United States in a search, it would include all children (all states, cities within those states, etc.) below it? Or does it just grab anything tagged at the United States level? – Adam Apr 11 '12 at 14:18
  • Views can filter it anyway you want. The trick isto define the view correctly. You may want to view the learning series dev.nodeone.se/en/taming-the-beast-learn-views-with-nodeone to learn the details of how to use it. Also, for future reference, this site answers drupal questions very well. Answerer's gain reputation by being recognized. When you think an answer is good, click the up arrow. If you think it is the correct answer, click the checkmark. – Ashlar Apr 11 '12 at 18:34
0

You can create a vocabulary with a term hierarchy so that the top level is each country, the second level is states or provences, and the third level is cities and towns. With this setup the Hierarchical Select module is very effective. Another approach is to use the Address Field module with Search Api's facet search. If someone chooses Boston then the only state and country in that facet will be Massachusetts and United States. Of course, if there is a Boston, England in the database that will show but for most instances it's effective.

0

There is a module called Reference Field Option Limit https://drupal.org/project/reference_option_limit that is perfect for a structure of destination vocabularies such as Country -> Region -> City

For a structure like this: Country -> Region -> City you need to create 3 vocabularies

Region and City need to have a term referenced field on them.

The module is well documented. https://drupal.org/node/1596310

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.