![]() |
|
Custom Sorting of images..Has anyone done this successfully? - Printable Version +- ZenphotoCMS Forum (https://forum.zenphoto.org) +-- Forum: Support (https://forum.zenphoto.org/forum-1.html) +--- Forum: General support (https://forum.zenphoto.org/forum-4.html) +--- Thread: Custom Sorting of images..Has anyone done this successfully? (/thread-6649.html) |
Custom Sorting of images..Has anyone done this successfully? - oldsportbiker - 2010-02-24 I've got a customer request to sort images by rating, hits, and image create date. I'm using the highslide theme for all galleries. I'm pretty database and PHP savvy, but before I start this I wanted to get guidance from anyone else who has done or attempted this. Custom Sorting of images..Has anyone done this successfully? - sbillard - 2010-02-24 Select "Custom" for your sort and enter the Database fields in the place provided. You can even enter joins on fields if you are SQL savy. Custom Sorting of images..Has anyone done this successfully? - oldsportbiker - 2010-02-25 Sorry for not being more specific. The customer wants me to code a user selectable sort and unless I'm missing something, the custom sort you mention is an admin option, not user selectable. Do I have that right? Custom Sorting of images..Has anyone done this successfully? - sbillard - 2010-02-25 Yes, this is an admin selectable sort. Please take a look at the Just do you thing and pass the list of fields to the function. As always, we recommend looking at the functions guide to see what you can do with the existing functions. Custom Sorting of images..Has anyone done this successfully? - oldsportbiker - 2010-02-25 Is the $sorttype variable used to identify a specific column in the database? For example, if we are sorting by date would the PHP value of $sorttype be "date" ? What is the syntax for referencing column names? Are they enclosed in doublequotes "date" or in single quotes 'date' or in tildes Custom Sorting of images..Has anyone done this successfully? - sbillard - 2010-02-25 Which function are you referencing? Generally sorttype would be the "kind" of sort, but it may be a combination of kind and direction. Kind in this sense is the selection from the sort option. Custom Sorting of images..Has anyone done this successfully? - oldsportbiker - 2010-02-26 When I use the actual database column name for $sorttype, it works the way I intended. For instance if I want to have the php code determine $sorttype for the images displayed in a gallery, I assign a value to $sorttype in the code as follows: $sorttype="rating"; I then pass in $sorttype to the paramater list for printRating() |