The link near the rss feed in the default theme for example, this one http://site.com/zenphoto/page/archive There's a list with all the months and the number of the photos uploaded. When I click on the month the photos are sorted by name, I would like to have them sorted by the time of the upload.
That view is produced by the search.php script. You would have to change the `next_image()` function to pass in the sorttype and direction. See the functions guide for detils. If you want to do this only for these date searches, you will have to make the parameters conditional on the search being that kind. (`isset($_REQUEST['date'])`)
Just an attempt cause I know nothing about php. I changed `<?php while (next_image(false, $firstPageImages)): $c++;?>` to ` <?php if (isset($_REQUEST['date'])) { while (next_image(false, $firstPageImages, mtime, image_sortdirection)): $c++; } else { while (next_image(false, $firstPageImages)): $c++; } ?> ` Of course, it's not working. Can you help a bit? Thanks.
Well, you have to pass a string for the sort type and direction so it would be `"mtime"` and `"DESC"` if you want descending otherwise just leave out the parameter.
Plus, you can't put a part of a loop in an if statement. So our if statement should setup say `$sorttype` and `$sortdirection` Then pass these as parameters in the original loop.
Comments
There's a list with all the months and the number of the photos uploaded.
When I click on the month the photos are sorted by name, I would like to have them sorted by the time of the upload.
`<?php while (next_image(false, $firstPageImages)): $c++;?>`
to
`
<?php
if (isset($_REQUEST['date'])) {
while (next_image(false, $firstPageImages, mtime, image_sortdirection)): $c++;
} else {
while (next_image(false, $firstPageImages)): $c++;
}
?>
`
Of course, it's not working. Can you help a bit? Thanks.
Plus, you can't put a part of a loop in an if statement. So our if statement should setup say `$sorttype` and `$sortdirection` Then pass these as parameters in the original loop.
`
`