Welcome Guest, Not a member yet? Register   Sign In
Implementing "Related posts" in CI?
#2

[eluser]jedd[/eluser]
[quote author="aquary" date="1248871040"]
For blogs, I'm thinking about using tags to determined which blogs are related. But right now I'm storing tags as a single string: "tag1, tag2, tag3", for using it as a page keywords only....[/quote]

As you've no doubt discovered, this is a pretty painful way of doing it.

You want to have a table that connects your blogs to your tags. It'd probably be called blog_tag. You would then have a tag table that lists all your available tags. You'd need some code that lets you manage (CRUD) your tag table, as well as manage the links (CRUD for blog_tag).

Your tag table would be quite simple:
Code:
id        SERIAL
tag      CHAR(27)

Your blog_tag would be comparably simple:
Code:
id           SERIAL
blog_id    BIG INT UNSIGNED           # fk to your current blog.id
tag_id     BIG INT UNSIGNED            # fk to tag.id

You'd have blog_id and tag_id as INDEX

Complexity arises if you want to share tags between other entities than blogs - you hint that you might want to use the same tagging system for forum threads too?


Messages In This Thread
Implementing "Related posts" in CI? - by El Forum - 07-29-2009, 01:37 AM
Implementing "Related posts" in CI? - by El Forum - 07-29-2009, 05:58 AM
Implementing "Related posts" in CI? - by El Forum - 07-29-2009, 10:01 PM



Theme © iAndrew 2016 - Forum software by © MyBB