Wednesday, October 5, 2011

Using Taxonomy to Post Contents on Drupal

Some of us have no idea about taxonomy. Actually i didn't know either what taxonomy was. When i built my drupal project, i recognized that i had to use it. I think, taxonomy is one of the most important features of drupal. Because, all content of your site, can be available with terms, verbs and tags on taxonomy.

So, imagine that you've just added content to your drupal site. If this content is a special of you, you'll want people to find it easly, right? Yes! Well, you need to use taxonomy now!

Step 1 : Select the content type you'll add a new field to.
Step 2 : You go manage fields and add a field on it for taxonomy.
Step 3 : Create a new verbs and add tags on it.
Step 4 : Your vocabulary is ready to use now! Add a new content and select tags from vocabulary!

Step 1

My choice is Basic Page content type. You need to click this path :
Click to the manage fields
After clicking; Step 2


As you see it up here, site is waiting for us to add a new field for our taxonomy. Adding is so easy. Just type like;

Label : "tax" //tax is my choice. You can change it
Field name : "field_"tax" //This name is for machine, generally select it like your label name
Type of data to store : "Term reference"
Form element to edit the data : "Autocomplete term widget (tagging)" //If you select it like this, you can add tag multiple, so this would be better?

And click Save button.

Selecting Vocabulary
Step 3

Well done! We create a new field for our tags. But the system asks us to select a vocabulary. Don't do anything on this page and open a new tab on your browser. Because of this, we are going to create a new vocabulary. The direction you'll go to is, "admin/structure/taxonomy/add".

add a new vocabulary for the field

Name : "Testing" //You can change it.
Description : "This is very important!"

And click Save button.


Click the add terms link.

When adding term

Type "php" for "Name" textfield and click the save button. And after that add: "ajax", "sql", "mysql", "dom", "c", "java", etc.
Now, turn back to the page we have to select a vocabulary for new field(tax) and refresh!

Select testing and Click Save Field Setting button.

For testing this vocabulary, add a new content. For that, use this path : "node/add/page".




Like you see, when i type something for tags, ready with Autocomplete term widget.


We'll see you next article!

No comments:

Post a Comment

Thanks