A community in which webmasters can ask for help with topics such as PHP coding , MySQL , IT jobs, web design, IT security.
Current location:homephp forumphp talk in 2009 yearCakephp Tagging - Auto Save new Tags and Tag Relations - page 1
User InfoPosts
Cakephp Tagging - Auto Save new Tags and Tag Relations#1
I read a lot about tagging in CakePHP but I can(t find a "clean" way to save a Post and the Tags to this post. I have all which is necessary the Post Table, Model and Controller, the Tag table, Model and Controller and the posts_tags table. I created the HABTM Associations in the Post and the Tag Model.

If I want to save a new post, I want that CakePHP automagically saves the tags associated to that post, but I can(t find the right way for that. In most of the tutorials you have to use a "helper" Function (http://www.jamesfairhurst.co.uk/posts/view/full_cakephp_application_part_5 => "_parse_genres") or something like that, but I thought the deal with CakePHP is it, that this is all done by Cake once you set it up right.

So my question, is there a "clean"-Cake-way to do it, or do I have to use a helper function?

posted date: 2009-04-16 01:36:00

Re: Cakephp Tagging - Auto Save new Tags and Tag Relations#2
I had made out the solution of this problem. click to view my topic...

hope that hepls.

posted date: 2009-04-16 01:36:01

Re: Cakephp Tagging - Auto Save new Tags and Tag Relations#3
I find it very hard to believe that you didn(t find a "proper" way to handle HABTM. There are many, many articles about it. I believe that Cake will save your tags if you set your data array properly. A quick search on The Bakery:http://bakery.cakephp.org/articles/search/3/HABTMWill reveal enough. My guess is that you(re looking for this:http://bakery.cakephp.org/articles/view/simple-tagging-behavior(Note that there is a component which does the same thing, but model behaviour is the right way to go)

posted date: 2009-04-16 05:51:00

Re: Cakephp Tagging - Auto Save new Tags and Tag Relations#4
ok thx for the links, I have found those too but I didn't know that this is the clean way to go. But you're right, the behavior one looks quite right

posted date: 2009-04-16 08:25:00

Re: Cakephp Tagging - Auto Save new Tags and Tag Relations#5
Glad I could help! Be sure to search the cakephp google group for HABTM if you get into trouble, there are many discussions on it (and I really do mean many).

posted date: 2009-04-16 09:00:00

select page: « 1 »
Copyright ©2008-2017 www.momige.com, all rights reserved.