Jump to content

How do I go about creating tags for articles?


fantasticham

Recommended Posts

I have a few articles that I would like to group together with tags. Like say I have two small articles I've written, I want both to have a tag bar full of words that define the page and when you click each word, it groups all the articles with the same tags.

 

Similar to the "filed under" thing on escapistmagazine.com: http://www.escapistmagazine.com/news/view/92935-Tecmo-Koei-President-Concerned-About-Motion-Controls-on-360-PS3

 

I'm unable to find a way to do this. Any help is appreciated.

There are a couple of ways of doing this.  If you plan on allowing more than one tag to be assigned to an article, then create a tags table, and a tag_associations table.  The tags table contains the actual tag while the tag_associations table creates the relationship between the tag and the article.  If you are only going to allow one tag per article, then simply adding another field to the article called "tag" would be efficient.  Then simply parse the table into a form and use $_GET['tag'] vars to display articles by category.

There are a couple of ways of doing this.  If you plan on allowing more than one tag to be assigned to an article, then create a tags table, and a tag_associations table.  The tags table contains the actual tag while the tag_associations table creates the relationship between the tag and the article.  If you are only going to allow one tag per article, then simply adding another field to the article called "tag" would be efficient.  Then simply parse the table into a form and use $_GET['tag'] vars to display articles by category.

 

I'd like more than one tag on each page, yeah. I'm pretty new to PHP and wouldn't really know where to start creating the table and grouping them together. I get the jist of what you're saying but I need it spelled out to me a little more. Sorry.

How much do you know about mysql table construction?  I'd begin by googling and practicing making mysql tables and querying them from php.

 

Good advice,

ATM it seems all your data is static which is fine except you would have to manually create a list for every single tag and update it manually, the other option which is more practical is to follow the above advice, dynamics are the core of a good php app.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.