Forum
Gallery CMS ordering
This is a question for developers. Rachel and Drew I know you're not really supporting this app now, but its being used and I need help.
The gallery is working as it should on the front end, issues I have is within the back end.
Because the client has lots of galleries (40 so far) he would like to be able to sort them in date order (the date the gallery was created). You can re-order it on a page by page, but this is not useful to him.
So does anyone know how I can change the code to list the galleries in order of when they were created or remove pagination so all galleries are listed on one page (not ideal)?
Thanks in advance
Health check
PHP 5.6.31 is up to date
MySQL 5.5.5-10.1.24-MariaDB is up to date
Image processing available
Summary information
Perch: 3.0.4, PHP: 5.6.31, MySQL: mysqlnd 5.0.11-dev - 20120503 - $Id: 76b08b24596e12d4553bd41fc93cccd5bac2fe7a $, with PDO
Server OS: Linux, cgi-fcgi
Installed apps: content (3.0.4), assets (3.0.4), categories (3.0.4), perch_forms (1.9), perch_gallery (2.8.9), perch_mailchimp (3.1)
App runtimes: <?php $apps_list = [ 'perch_gallery', 'perch_forms', 'perch_mailchimp', ];
PERCH_LOGINPATH: /cms
PERCH_PATH: /home/sites/website.com/public_html/cms
PERCH_CORE: /home/sites/website.com/public_html/cms/core
PERCH_RESFILEPATH: /home/sites/website.com/public_html/cms/resources
Image manipulation: GD
PHP limits: Max upload 256M, Max POST 256M, Memory: 512M, Total max file upload: 256M
F1: 0c66c2e1f82f9e0b7617b2cb8270f2c7
Resource folder writeable: Yes
HTTP_HOST: www.website.com
DOCUMENT_ROOT: /home/sites/website.com/public_html
REQUEST_URI: /cms/core/settings/diagnostics/
SCRIPT_NAME: /cms/core/settings/diagnostics/index.php
Juan, don't worry... Perch Gallery App is still supported and available in the addons... so your safe there :)
I know this is an often repeated thing from me... but yes you can do this but it will require a custom app.... go ahead and shoot me now, but I am an app developer so its the first thing that pops into my head.
Anytime you want to change how something works within the Perch UI, it's normally going to require custom JS or a custom app. Please never modify an app as this will end support for your installation unless you fully restore the app.
In this case here is how I would approach it:
Build a micro app, basically an admin app which only lists the galleries in the order your client is requesting which all the links point to the gallery app. This will leave the gallery app unmodified and the micro app will only be generating links which when clicked on will point to the actual app.
The only issue is this... Once you click a link it will open the gallery app, then you will have to switch back to your micro app if you want another listing. But this should not be a big deal.
So there you have it... "There's an app for that..." you just have to build it... :)
Have you added a creation date to your albums? If so you should be able to order by that.
Hi Drew
I'm not sure how i'd go about doing that, I've search forums and documentation but cannot find anything. Do you have a link to where id find info in the docs about adding a creation date please.
Juan, this would just be adding a date field to album.html then sorting the output by the date field.
https://docs.grabaperch.com/templates/field-types/date/
https://docs.grabaperch.com/video/v/template-tag-type-date/
Hi Robert
Many thanks for replying.
Adding a date field to album does not show up on the form in Admin. Looking at the php files that generate the gallery pages, they are calling albumTitle, albumDesc, albumOrder so I guess I'd need to tell it to so the same with the date field, but we're not supposed to edit the core files.
You have to be in the proper namespace... your using perch:content when it should be perch:gallery
But I am afraid this isn't going to solve your problem when listing in the admin panel, as there does not seem to be sort options for the gallery app.
Wrong NAMESPACE:
<perch:content id="albumDate" type="date" label="Date" format="d-m-y" native="true" />
Right NAMESPACE:
<perch:gallery id="albumDate" type="date" label="Date" format="d-m-y" native="true" />
When sorting dates I always find YYYYMMDD to be best...
Silly me. Didn't notice the namespace.
Any idea what Drew was referring to?
I think Drew was thinking the same as I when he answered...
that your wanting to sort the output to the front end, not to admin... But I guess we will have to wait till Drew is available to confirm.
I took a quick scan through the code and I don't see any way to sort for the admin (backend).
Ah maybe I wasnt clear in my original post. But yeah the client needs to be able to sort the albums in a more logical order. Ie newest first.
There is a field for order already in albums, so it’s just a matter of adding a number here to order the albums. This seems to be the simple fix to sorting without rewriting the gallery app. But in my observation there is no other (automatic) way at this time.
Yeah there is, but the problem, for client at least, is that the sorting is per 'page' and he currently has 4 pages worth of galleries
But the value should still sort correctly.. it shouldn't start over with each page, it should show 1-20, 21-40, 41-60, not 1-20, 1-20, 1-20.
Anyways, I don't have a solution here except to say I would use a list and detail template with a repeater for the album images and not use the gallery app at all, but I know this doesn't help you in an existing site.
RK
EDIT: also, by adding the date field it will at least allow them to see when the album was actually created.
Hey Robert
Thanks for the replies and trying.
The problem with the sorting is that its useless when there are loads of pages. The sorting is not kept on page refresh. Client would want to see latest galleries on Page 1.
I am using the list and detail template for this and this is not the issue, the issue is the admin side of the gallery app - looks like I'm at a loss.
It seems that now if you want to do anything with Perch, you need to be using Runway, which is expensive for most clients.
Perch is a great product. Is has really developed from the first version. It was always meant to be a “Simple” CMS and still is, but the functionality that has grown into Runway is an attempt to keep Perch as it was originally intended.
At some point a line has to be drawn and a lot of my clients will ask me “well, can you just add this” that’s all I’m asking.... and if you keep moving that line... where do you decide to put it next?
So, the price of Runway is a factor in smaller sites, but if clients want the functionality which is Runway they need to accept its going to come at a price. The functionality you ask for was never part of Perch, nor part of gallery’s therefore nobody has lost a function or feature, they would like it the improvement without paying for its development.
I understand this is hard to explain and for clients to accept but really they got what they were paying for at the time and unless a developer over promised and under delivered because a function wasn’t available in the product.
Not being a pain here, just my friendly opinion.
Robert Ketter :)
I get what your saying. I didn't over promise and under deliver.
I originally built the site in perch because it didnt need the extra functionality of runway. I had built it so that when the client added a new vehicle, he would add all the images for that vehicle as well as filling in all the details for that vehicle. But then the client said he just wanted to just be able to batch upload for several cars within the same interface.
This is after it was built. If that had been a requirement from the start, I would have explored Runway.
Guess I better dust off my PHP books then :)
Thanks for trying to help, its appreciated.
Are you Ketter.us ? Going to speak to my client, see if he is happy to pay for some extra dev work.
Yes, That is me on the Perch Registered Developers.
https://grabaperch.com/developers