I know this topic is all over the map, but I wondered if someone could give me an overview of what I'm going to be doing? I just recently installed Drupal and have learned the basics of adding content (very basic). I haven't yet found the tutorial for the BIG project and would like to have a clue about what it involves.

I want to connect my website to my animal kingdom database, which will display articles about various species and groups of animals at URL's that look like these:

www.geozoo.org/stacks/Mammalia/
www.geozoo.org/stacks/Carnivora/
www.geozoo.org/stacks/Canidae/
www.geozoo.org/stacks/Canis_lupus/

Except on my computer they'll look like this for the time being:

http://drupal/stacks/Mammalia/
http://drupal/stacks/Carnivora/
http://drupal/stacks/Canidae/
http://drupal/stacks/Canis_lupus/

So let me ask some very basic questions...

1) If I understand correctly, I can use an Apache function called mod_rewrite function to customize my URL's, right?

2) Therefore, I don't have to create any additional physical pages; I could display all of these articles on my home page, though the URL's would change, right?

3) However, I think it would probably be smart to create a second page to serve as a template for this series of pages, since they'll be quite different from the home page. Does this make sense?

4) If so, then can I simply go into Windows explorer and create a new folder, like this?:

C:\sites\drupal\stacks\\

...then insert a new page like this?:

C:\sites\drupal\stacks\index.php

I've displayed data from database table on web pages before, so I think I know what to expect there. But I don't understand how you make various articles appear on one page. Is there a name for this technique, or can you point me to the place in the Drupal manual that explains how to do it?

In other words, rather than create separate pages, like this:

C:\sites\drupal\stacks\Carnivora\
C:\sites\drupal\stacks\Canidae\
C:\sites\drupal\stacks\Canis_lupus\

I want to create ONE page, like this:

C:\sites\drupal\stacks\index.php

Articles about Canivora, Canidae, etc. will all be displayed on this one page, even though the URL's will make it look like they're on different pages.

That's my ultimate goal, and I don't know how to study it because I'm not even sure what it's called or where it's discussed in the database.

Thanks.

Comments

Boris Mann’s picture

You should be able to do everything you want directly within Drupal. For any content you add, you can add taxonomy information. Drupal automatically uses mod_rewrite if it is installed, and will re-write URLs for you. In addition, the pathauto module will automatically create those URLs for you.

Check out John VanDyk's Iowa State Entomology Index of Internet Resources which uses taxonomy and the directory module to enable some neat faceted browsing.

robertDouglass’s picture

Are you going to need to pull information from a SQL database and you're asking how to make the URLs conform to the pattern above? I'm confused as to what your goal is. Try restating what your goal is out of the context of what you know or expect from Drupal. Just tell us exactly what you're trying to do.

- Robert Douglass

-----
If this helped you, please take the time to rate the value of this post: http://rate.affero.net/robertDouglass/

www.hornroller.com, www.robshouse.net

DavidB’s picture

My website focuses on the animal kingdom. I have a MySQL database with thousands of entries for various taxonomic levels - species, families, orders, etc. in a child-parent relationship. For example:

Name | PARENT
Carnivora | Mammalia
Canidae | Carnivora
Canis | Canidae
Canis_lupus | Canis

I may use a recursive array instead or in addition (once I learn how to make one).

I have similar sites that feature continents, nations and states listed in a child-parent relationship in a database. Each jurisdiction has an ID. For example, New York is ny. So if I put $mycode = 'ny'; in a page's head section, that page will display information about New York.

My animals site will probably work in a similar manner. For example, the head section might include this line:

$mycode = 'Canis_lupus';

That page would then display information about the wolf. But instead of creating 6,000 pages to display information about each mammal species, I just want a single page that displays information about whatever species (or family, order, etc.) a visitor wants to read about.

I should also add that each page will presumably consist of various blocks of data imported from my database. For example, my database may include a short introduction about each species. Below that I might display each species' dental formula, also drawn from the database.

In other words, each page won't be a single article; rather, it will be a collection of brief articles and snippets of information.

I don't want to overwhelm you with questions, but I should mention one more thing. I'm thinking of producing TWO accounts for each species, family, etc. - one for adults, the other for children.

Tentatively, I'm thinking of the following URL scheme:

www.geozoo.org/stacks/Mammalia/
www.geozoo.org/stacks/Carnivora/
www.geozoo.org/stacks/Canis_lupus/

www.geozoo.org/kids/Mammalia/
www.geozoo.org/kids/Carnivora/
www.geozoo.org/kids/Canis_lupus/

Except, I'm building my site on my computer, so the first article would display at http://drupal/stacks/Mammalia/ for the time being.

I'm assuming I could display every one of these articles on a single page, or "template." However, if there's a dramatic difference between the adult and kids pages, then it might make sense to make a separate template for each page.

* * * * * * * * * *

My site will actually be very similar to the Animal Diversity Web (ADW) - here's a sample page: http://animaldiversity.ummz.umich.edu/site/accounts/information/Canis_lu... - except I want a nicer appearance, and I'll have more features.

The ADW uses Plone, which is intriguing, but WOW! I downloaded it, and it blew me away; it looks awfully complex.

Another inspiration is the Tree of Life website. Here's a sample page: http://tolweb.org/tree?group=Mammalia&contgroup=Therapsida

I haven't yet figured out how they built their site, but they use an "edge representation method," which I think is a fancy name for a recursive array.

I hope I didn't ramble too much. I just wanted to give you an idea of what I'm trying to accomplish.

Thanks!

Boris Mann’s picture

Drupal is a database driven system. Is there any reason you wouldn't just build the content directly in Drupal? It sounds like even importing it into Drupal would be a better way to go.

For your location information, check out the location module, which handles storing all location information.

DavidB’s picture

Good question! I built my MySQL database before I downloaded Drupal, and I figured I'd just be connecting it to Drupal somehow.

I don't understand what you mean by "build the content directly into Drupal" and "importing it into Drupal."

My understanding is that MySQL and XML (which I know virtually nothing about) are the standard databases used with PHP. So I assume you simply mean I should import my database tables into my Drupal database?

I'm not sure what you mean by "location information," either, but I'll check out the Location module. I just downloaded the PathAuto module, though I won't do anything with it until I have a clearer idea of what I'm doing.

Incidentally, I'm thinking of using a combination of MySQL and XML. I thought XML might be a better choice for storing longer articles, but I still have a lot to learn about it.

Thanks.

Boris Mann’s picture

Drupal can probably run everything, including storing content in the database -- that's it's job, that's what it does. Every forum post, every comment, etc. here on Drupal.org are all stored in a database AND displayed by the drupal system itself. It's all integrated.

The entomology site I linked to earlier is worth looking at, as it most closely resembles what you are trying to build.

My recommendation would be to ignore your database for now (trust me...) and just create some content in drupal.

1. Go to Administer > Categories and create your taxonomies
2. Create content and apply taxonomy information
3. Voila! Content organized as you like it

robertDouglass’s picture

What you need to know is that with clean URLs turned on, a URL like
http://www.yoursite.com/stack/puppydog will generate a $_GET['q'] parameter with the value stack/puppydog. That means you can intercept that, split it, and grab the information from your database for display in your site. I disagree with Boris that you would need to import the content directly into Drupal; if you have a huge database and a means for entering data otherwise, there is no need for this. On the other hand, you do gain lots of great extras by having your data stored as some form of Drupal node. Perhaps you could give us more insight as to the nature of your data? What tables do you have? What are some sample data sets?

It would be a very straightforward task to write a custom module for displaying your data using the URL scheme you are looking for. Let me know if you are interested in hiring anyone to consult or to program such a custom module (use the contact form on my user page).

- Robert Douglass

-----
If this helped you, please take the time to rate the value of this post: http://rate.affero.net/robertDouglass/

www.hornroller.com, www.robshouse.net

DavidB’s picture

I contacted the webmaster of the Iowa entomology site, and he gave me some useful tips, too. I guess it will be a while before all of this makes sense to me. It is hard to see how I could part with my database and recreate it using Drupal, as it's huge. My Mammals table alone has over 5,000 rows.

At present, my tables look something like this:

N | ID | NAME | PARENT
1 | mam | Mammalia | Animalia
2 | car | Carnivora | Mammalia
3 | can | Canidae | Carnivora
4 | can | Canis| Canidae
5 | can_lup | lupus | Canis

I have separate tables for mammals, birds, etc. The Mammals table lists every order, family, subfamily, genus and species of mammal in a child-parent relationship. I know how to display data from this using PHP, though there are many kinks to be worked out.

I'm debating whether it would be better to break my tables up into categories, listing all the ORDERS of mammals, birds, reptiles, etc. in one table, all the FAMILIES in another table, etc. I'm not sure what the advantages would be.

I need to learn how to make a recursive array. At that point, I'll either choose between a child-parent relationship and a recursive array or use both in different capacities.

After I get all of this straightened out, I need to create tables with a variety of information. For example, one table will list names - common names (wolf), plurals (wolves), group names (pack), etc. Another table will list the number of toes on each front foot and hid foot. Another will list dental formulas.

But rather than list this data for each species, I'd like to list it for the entire order and family and pass it down to each species, where possible. Thus, I could say that the order Carnivora has five toes on each front foot and hind foot. But then I might have to say that a certain family in the order Carnivora has 5 toes on each front foot, 4 on each hind foot, and a certain species in that family has 4 toes on each foot.

Some entries will be longer, and I don't know if I'm comfortable putting articles in a database. Thus, my interest in XML.

I'd love to hire a consultant if I could. Unfortunately, I've been unemployed for three years.

Thanks.

robertDouglass’s picture

Part of me is starting to agree more with Boris; what you're doing is exactly what Drupal does with its taxonomy system and you'd be unwise to try to program code that does the same stuff over again when you have Drupal code already finished. Taxonomy can handle all of your classification needs. Everything you've described. I think you'd be best off taking Boris' advice and forget about your existing data for a while. Study the taxonomy (categories) system and figure out how to model everything you want to do using flexinodes (see contributed module) and taxonomy. Then, when you've figured out how your site is going to work from the Drupal end, your only programming task will be to write a SQL script that imports your existing data into the Drupal database.

- Robert Douglass

-----
Rate the value of this post: http://rate.affero.net/robertDouglass/
I recommend CivicSpace: www.civicspacelabs.org
My sites: www.hornroller.com, www.robshouse.net

DavidB’s picture

So I CAN import my data into Drupal's database. I was afraid I'd have to start from scratch.

But when you talk about importing it into Drupal's database, are you simply talking about importing my database tables into the MySQL database I created to hold the 50+ tables I downloaded with Drupal?

That would be even easier. I was afraid you were talking about some mysterious process that would take a while for me to understand.

Thanks.

robertDouglass’s picture

I'm afraid I meant the magical mysterious version of import.

Drupal offers two concepts which are useful to you in this case; nodes and categories. Categories [1] consist of vocabularies and terms. A vocabulary is a collection of terms. You would make a vocabulary called "Classification" and make a hierarchical set of terms that follow the King Phillip Came Over From Germany Swimming business. Then you would create nodes (individual animals) and select the taxonomy term that applied to them. That way, if you wanted to make a node "Human being", you could use a term all the way at the bottom of the taxonomy hierarchy. If you wanted to make a node "Primate" you would use a term somewhere higher up (Family?). You could even have nodes like "Plant" or "Animal" and categorize them with terms from the Kingdom level.

What do you get from doing this? LOTS! You automatically have ways to search for and display your critters based on their classification (no need to write any search code), and there are all sorts of modules in the contrib repository that capitalize on taxonomy.

Then, when you've gotten the hang of it all (lets say you make a taxonomy with two or three branches that extend all the way to the Species level, and 20 animals that fit into those classifications) you do the Magic. You look at how Drupal stores its data in the taxonomy and node tables, compare that with the data you've downloaded, and make a migration plan. The plan will go something like this:

  1. Select a row from the animal db
  2. Break it down into animal type and classification
  3. Create a node in Drupal with the animal type
  4. Apply the correct taxonomy classification
  5. repeat.

This will take programming. Fortunately, if you can do PHP/SQL programming, this is well within reach. Drupal offers functions that will handle the node creation and the classification - that's been done for you already. Plus people here will help with friendly tips and advice.

First, though, you've got to get your head around nodes and taxonomy, so take your new and shiny Drupal site and learn to use it, inside and out. It's fun.

cheers,

- Robert Douglass

[1] really called taxonomies, but we hide that fact because the word scares soft animals and small children

-----
Rate the value of this post: http://rate.affero.net/robertDouglass/
I recommend CivicSpace: www.civicspacelabs.org
My sites: www.hornroller.com, www.robshouse.net