Custom datasource / grouping and sorting using only a piece of a value
This is an open discussion with no replies, filed under General.
Search
Create an account or sign in to comment.
This is an open discussion with no replies, filed under General.
Create an account or sign in to comment.
Quick Links
Symphony • Open Source XSLT CMS
--with-xsl
)
Hello everyone!
I’m creating a very simple database which collects various essays and articles ordered by date.
My problem is that not all the articles have a “complete” date (day/month/year), some of them have only the month (–/month/year), some others only the year (–/–/year), therefore – instead of using the usual date field – I’ve decided to create three different text input fields, one for the day, one for the month and one for the year.
When a piece of information is not available, the author simply types 00 in the field and the value is transformed in the front end into an en dash which corresponds to the missing piece of information in the formula day/month/year.
At the moment the datasource attached to the page where the list is displayed groups and sorts the various articles using the text input field “Year”, then the rest of the sorting (by day and month) is done using XSLT:
This allows me to achieve the result I was looking for, but I’m wondering if it is possible to avoid separating the day, the month and the year into three different text input fields and use only one (I’ve found this thread which arose my curiosity), creating a custom datasource which groups the articles taking as a reference for the grouping only a piece of the value inserted in the field (the last 4 letters corresponding to the year).
I think such a result can be achieved using XSLT:
but I’ve no idea if it can be done using PHP nor if Symphony allows it. Is it possible to have something like this in a custom datasource?
I don’t know PHP so please forgive me if I’ve written such a nonsense as an example mixing PHP and XSLT, it’s just to let you get the idea!
Many thanks!