Sometimes you may not be satisfied with the order of articles in the Sections module. To change it, edit the following line of the modules/Sections/index.php:
$result = sql_query("select artid, secid, title, content, counter from ".$prefix."_seccont where secid=$secid $querylang", $dbi); |
Change it to[1]
$result = sql_query("select artid, secid, title, content, counter from ".$prefix."_seccont where secid=$secid $querylang ORDER BY artid DESC", $dbi); |
![]() |
Changing the order of results |
---|---|
This is a typical example of changing the order of results of a database selection. This was achieved by solely adding "ORDER BY artid DESC" to the SQL query string. In plain text, this means "order the results by descending article id". The "right way" would of course be to sort by time. But lacking an extra timestamp field, we make use of the fact that later articles have a higher id. Thus, sorting by descending id will give last articles first. Think of this simple trick whenever you seek a simple way to change the order of some results. |
[1] |
Help us make a better PHP-Nuke HOWTO!Want to contribute to this HOWTO? Have a suggestion or a solution to a problem that was not treated here? Post your comments on my PHP-Nuke Forum! Chris Karakas, Maintainer PHP-Nuke HOWTO |