We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Posts with category and tags

Hey

I need to know how i should be doing this the right way.

I have the tables

Posts PostsCategories PostsTags

When you create a post you can add up to 25 categories, and 10 tags.

Should i then insert them in the 3 tables or should i have them in 2 rows where i seperete each tag and categorie with a comma?

If i put them i tables, it would be like inserting 36 rows at one time? Like 25 categories, if all are selected and 10 tags if all are used and the post it self..

How should I be doing this ? :-)

Hope you understand..



31.3k

two tables Posts and metas with type=cate or tag

edited Mar '16

So i should insert about 15 new rows to metas?

Like :

type=categorie catid=2

type=categorie catid=3

type=categorie catid=6

type=categorie catid=8

and

type=tag = tagname=test

type=tag = tagname=hello

type=tag = tagname=welcome

type=tag = tagname=first

Or how do you mean?

Imho 3 seperated tables. And of course Category table and Tag table. You can create categories/tag in CLI Application, just use jobs and beanstalkd to doesnt make unnecessary inserts in request-response time.

Can you give me an example ?

Im not sure i understand..