10390 Posts in 2201 Topics by 1712 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 421 Views |
-
TagField module

13 June 2011 at 9:00pm
Hello,
I am interested in using this module on some custom things i programmed like Link Of The Day (LOTD extends DataObject in LOTD.php) so I would like to know how to add tags and search options for that custom class, in this case, how to use TagField module to add tags to it?
I made a form for frontend submitting and editing of LOTDs on LOTDPage.php (LOTDPage extends Page) and would like to add some tags to it for easier search
Also, is som1 knows how to add custom DataObject to built-in search I would appreciate it.Ty all
-
Re: TagField module

15 June 2011 at 11:24pm
Added tags to my DataObject, they are put to DB, how to use them?
What to put in template for tags to be usefull? -
Re: TagField module

16 June 2011 at 8:40am
The TagField works with a many_many relationship.
Tag.php
class Tag extends DataObject {
static $db = array (
'Title' => 'Varchar'
);static $belongs_many_many = array (
'SomeObjects' => 'SomeObject'
);
}YourDataObject.php
class YourDataObject extends DataObject {
static $many_many = array (
'Tags' => 'Tag'
);public function getCMSFields() {
return new FieldSet (
new TagField('Tags')
);
}
}--------------------
SilverStripe tips, tutorials, screencasts and more: http://www.leftandmain.com -
Re: TagField module

16 June 2011 at 6:17pm
Yes UncleCheese, thank you, but, after you have added tags to class, which I did, how do you use them?
If I understood correctly it should be like the tags in blogmodule... usable in a form of a link in a way that when i click on a single tag, i get all of my DataObjects with the same tag displayed.
If not atlest that I can search the DataObject by tags, no?So can you show me the example of template in which they are used?
BTW nice that you started doing tutorials, I will look at it l8r.
-
Re: TagField module

20 June 2011 at 6:34pm
BUMP
Anyone knows how to make those tags usable? Or did I just figure it out wrong and they aren't usable as in blog module so each is a link you click that then list all of the others with same tag?Are they searchable?
How to write it in template?
| 421 Views | ||
|
Page:
1
|
Go to Top |

