<?xml version="1.0" encoding="utf-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>selfoss support forum - ASC / DESC</title>
<link>https://forum.selfoss.aditu.de/</link>
<description>selfoss support forum</description>
<language>en</language>
<item>
<title>ASC / DESC</title>
<content:encoded><![CDATA[<p>Hello,</p>
<p>I wanted to have unread items ascending and other descending (acording to datetime), so I have done it this simple not very clean way (see patch). Are you interested, if I will do it more clean way (maybe as configuration option new_ascending = true / false) for all DBs and send you patch, or do you want to implement it yourself, or not interested at all?</p>
<p>Kind regards,</p>
<p>xvasek</p>
<p><br />
@@ -21,14 +21,17 @@ class Items extends \daos\mysql\Items {<br />
     public function get($options = array()) {<br />
         $params = array();<br />
         $where = '';<br />
+        $direction = 'DESC';</p>
<p>         // only starred<br />
         if(isset($options['type']) &amp;&amp; $options['type']=='starred')<br />
             $where .= ' AND starred=true ';</p>
<p>         // only unread<br />
-        else if(isset($options['type']) &amp;&amp; $options['type']=='unread')<br />
+        else if(isset($options['type']) &amp;&amp; $options['type']=='unread') {<br />
             $where .= ' AND unread=true ';<br />
+            $direction = 'ASC';<br />
+        }</p>
<p>         // search<br />
         if(isset($options['search']) &amp;&amp; strlen($options['search'])&gt;0) {<br />
@@ -64,7 +67,7 @@ class Items extends \daos\mysql\Items {<br />
                     items.id, datetime, items.title AS title, content, unread, starred, source, thumbnail, i<br />
                    FROM items, sources<br />
                    WHERE items.source=sources.id '.$where.'<br />
-                   ORDER BY items.datetime DESC<br />
+                   ORDER BY items.datetime '.$direction.'<br />
                    LIMIT ' . $options['items'] . ' OFFSET ' . $options['offset'], $params);<br />
     }</p>
]]></content:encoded>
<link>https://forum.selfoss.aditu.de/index.php?id=508</link>
<guid>https://forum.selfoss.aditu.de/index.php?id=508</guid>
<pubDate>Wed, 05 Jun 2013 19:49:52 +0000</pubDate>
<dc:creator>xvasek</dc:creator>
</item>
</channel>
</rss>
