Can this be done? All my photos remain in the same order as they were uploaded, but I would like to be able to randomise the display on the index and category pages (like in the side block), to show a different range of photos with each page load.
Any ideas much appreciated.. thankyou.
fully randomize?
just modify ordering condition.
index.php line48:
$prs = $xoopsDB->query( "SELECT l.lid, l.cid, l.title, l.ext, l.res_x, l.res_y, l.status, l.date, l.hits, l.rating, l.votes, l.comments, l.submitter, t.description,c.title AS cat_title FROM $table_photos l LEFT JOIN $table_text t ON l.lid=t.lid LEFT JOIN $table_cat c ON l.cid=c.cid WHERE l.status>0 ORDER BY date DESC" , $num , $pos ) ;
viecat.php line106:
$prs = $xoopsDB->query( "SELECT l.lid, l.cid, l.title, l.ext, l.res_x, l.res_y, l.status, l.date, l.hits, l.rating, l.votes, l.comments, l.submitter, t.description $select_append FROM $table_photos l LEFT JOIN $table_text t ON l.lid=t.lid $join_append WHERE $where AND l.status>0 ORDER BY {$myalbum_orders[$orderby][0]}" , $num , $pos ) ;
Both should be "rand()".
in index.php i have modified ORDER BY rand() (with myalbum 2.90) but it dosn't work...
(in viewcat.php he work fine)
do you know why? i need it into index.php
I've checked it and it works fine.
Check: Is index.php you edit the module you access.
yes, index.php is the right....
// Assign Latest Photos
// riga qui sotto mod by sly: era ORDER BY date DESC
$prs = $xoopsDB->query( "SELECT l.lid, l.cid, l.title, l.ext, l.res_x, l.res_y, l.status, l.date, l.hits, l.rating, l.votes, l.comments, l.submitter, t.description,c.title AS cat_title FROM $table_photos l LEFT JOIN $table_text t ON l.lid=t.lid LEFT JOIN $table_cat c ON l.cid=c.cid WHERE l.status>0 ORDER BY rand()" , $num , $pos ) ;
but i have made any test with:
ORDER BY title ASC or DESC or date ASC or DESC etc... and
result don't change!!!! so it's mean this is not my lines!!!
i don't remember but maybe i have modified another file with the sort order... do you know what should be ?
thanks a lot...
Check module cache in admin -> system -> preferences -> general.
it's
no cachei remember wich (maybe) i have modified a file of myalbum with
ORDER by ..... .... but i don't remember wich file....
Quote:
GIJOE wrote:
I've checked it and it works fine.
Check: Is index.php you edit the module you access.
gijoe belive me.... here dosn't work... i don't know why... i have made all modification correctly...
it's a mystery...
nothing else...
There are only two reasons.
- The file you edited is wrong one.
- Cache
That's all.
I don't know if this is what you mean, but I think I had the same problem.
Eventually I found out (with some help) that in the includes folder there is a file called 'draw_functions.php'
In that file at line 201 you will find the following code:
$crs = $xoopsDB->query( "SELECT cid, title, imgurl FROM $table_cat WHERE pid=$parent_id ORDER BY title") or die( "Error: Get Category." ) ;
change the value after ORDER BY to what you want..
Hope this helps,
greetz Frank