Or, can I get cms:pages to deliver pages in the order provided by the id parameter?
So, I am running a db query that I don't see how to successfully use Couch's amazing regular features to accomplish. To be to the point, I don't want to overload the built in publish_date for event start times. I have my reasons.
Using separate start_date start_time and a custom SQL query via cms:query I can get exactly the right page id's in the right sort order that I want for events, (everything today or later, sorted in nearest time (asc) order. My challenge is when I later call cms:pages with the ids in sort order it returns them in its own order. What's weird is that the orderby used in the cms:pages call with an id set to a list, does not seem to actually use the orderby. Or, if it does, 11:00 is now < 08:00. This may be a real bug, I have not simplified this to a test case to see if there is a bug when using id and orderby together.
I know my SQL is correct, because when I run it straight against the db I see the results I want and expect. I also see through cms:dump that I capture those values in the proper order, with the proper separator, ",", to be used with the id parameter of cms:pages. However the order I am seeing my data displayed in the HTML page does not match the database, the id list, or the orderby order.
My results straight from the db:
The id list my page ids are captured into:
My cms:pages call:
The order I am seeing my pages displayed in my HTML page is:
I am happy to work on helping debug this problem, but right now I need a solution to just get this working correctly. I was intending on being finished with this site tomorrow. Clearly, that may not happen.
Thank you kk and cheesypoof for such an amazing website creation tool. I love CouchCMS, and still think about
how I'd implement a similar tool with flat files for the really simple sites. Not every site needs a RDBMS back end, great opensource software just made it too easy to do, and now almost everyone does.
For anyone curious as to why I did not just use comparison operators with the custom_field parameter of cms:pages, I did try. I found that although comparison operators work in cms:if statements with date or time strings, they are not useable in the former context. Believe me, I wish they had been. My life would have been a lot easier.
So, I am running a db query that I don't see how to successfully use Couch's amazing regular features to accomplish. To be to the point, I don't want to overload the built in publish_date for event start times. I have my reasons.
Using separate start_date start_time and a custom SQL query via cms:query I can get exactly the right page id's in the right sort order that I want for events, (everything today or later, sorted in nearest time (asc) order. My challenge is when I later call cms:pages with the ids in sort order it returns them in its own order. What's weird is that the orderby used in the cms:pages call with an id set to a list, does not seem to actually use the orderby. Or, if it does, 11:00 is now < 08:00. This may be a real bug, I have not simplified this to a test case to see if there is a bug when using id and orderby together.
I know my SQL is correct, because when I run it straight against the db I see the results I want and expect. I also see through cms:dump that I capture those values in the proper order, with the proper separator, ",", to be used with the id parameter of cms:pages. However the order I am seeing my data displayed in the HTML page does not match the database, the id list, or the orderby order.
My results straight from the db:
- Code: Select all
pid tname fdname ddvalue ftname dtvalue
114 events.php start_date 2015-05-18 start_time 08:00
113 events.php start_date 2015-05-18 start_time 11:00
130 events.php start_date 2015-05-22 start_time 12:00
The id list my page ids are captured into:
- Code: Select all
definitely_future: 114, 113, 130
My cms:pages call:
- Code: Select all
<cms:pages masterpage='events.php'
id=definitely_future
orderby='start_date, start_time'
order='asc' paginate='1' limit='6'>...</cms:pages>
The order I am seeing my pages displayed in my HTML page is:
113, 114, 130
I am happy to work on helping debug this problem, but right now I need a solution to just get this working correctly. I was intending on being finished with this site tomorrow. Clearly, that may not happen.
Thank you kk and cheesypoof for such an amazing website creation tool. I love CouchCMS, and still think about
how I'd implement a similar tool with flat files for the really simple sites. Not every site needs a RDBMS back end, great opensource software just made it too easy to do, and now almost everyone does.
For anyone curious as to why I did not just use comparison operators with the custom_field parameter of cms:pages, I did try. I found that although comparison operators work in cms:if statements with date or time strings, they are not useable in the former context. Believe me, I wish they had been. My life would have been a lot easier.