How to add tags using PHP
Permalink
Hi
The docs, as usual have come up short, how can I add tags to a page object using PHP?
Thanks
The docs, as usual have come up short, how can I add tags to a page object using PHP?
Thanks
Not sure but best guess:
So, if you want to add new ones to existing:
The SelectAttributeTypeOption also has a static method add() but I guess the method above is easier (if it works).
$newPage->setAttribute('tags', array('golf', 'news', 'walks'));
So, if you want to add new ones to existing:
$old = $newPage->getAttribute('tags'); $newPage->setAttribute('tags', array_merge($old, array('new', 'new2')));
The SelectAttributeTypeOption also has a static method add() but I guess the method above is easier (if it works).
Hi
Thanks! I have just found that too here
http://www.concrete5.org/community/forums/customizing_c5/cannot-add...
Thanks again
Thanks! I have just found that too here
http://www.concrete5.org/community/forums/customizing_c5/cannot-add...
Thanks again
But this only adds one tag and not three. Looking at the page properties there is just "walks" and not the other two, it is like the first two are ignored and overwritten by the third?
Any ideas?
Thanks