Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

tagfield : how to output tags in same order they were entered?


Go to End


2 Posts   1159 Views

Avatar
DsX

Community Member, 178 Posts

11 January 2011 at 9:02am

I am using the tag field for a number of short text fields in my system, and until recently it appeared to work perfectly.
But as I entered more data and started to reuse tags, I found the output of the tags to my pages are not in the order I entered them.

How might I go about setting the module to output tags in the same order that they have been entered?

Avatar
DsX

Community Member, 178 Posts

11 January 2011 at 4:20pm

Looking at the database I see that I may be able to get the behavior I want by sorting the tags based on the ID from the Many-Many relation table.

I am guessing that if tags are entered in the correct order, that this order is reflected in the ID numbers in the relation table?
So if Tags are not in the correct order, that removing all tags, saving, and then reentering the tags in the correct order would rewrite the unique ID to the relation table and allow me to sort them correctly?

If this is in fact how this is working (hoping someone with more experience here might know) how might I go about extending this class to sort in this manner?