Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#973 2024-10-01 01:42:56

maruchan
Member
From: Ukiah, California
Registered: 2010-06-12
Posts: 595
Website

Re: smd_gallery: super-flexible gallery generator

Bloke wrote #337906:

Now that is a challenge! How would you know what page the clicked image is on, short of assuming that the images are sequential and dividing the total by the number of images per page to predict the page number and injecting it in the URL as &@pg=@?

I like it! And…my images aren’t sequential.

Darn!

I wonder if it’s worth running smd_gallery twice, to populate some kind of JS array on the second run, like hey, this image ID is on this page, and we use an array lookup in JS to grab the right page number and add it to the separate link from the sidebar…hmm…

Oh…I guess I don’t know if smd_gallery exposes access to some pagination counter on the tag side. Going to check!

(Thinking aloud, not meaning to annoy!)

Last edited by maruchan (2024-10-01 01:47:39)

Offline

#974 2024-10-01 09:27:38

etc
Developer
Registered: 2010-11-11
Posts: 5,134
Website GitHub

Re: smd_gallery: super-flexible gallery generator

If it helps, in MySQL 8 you can use ROW_NUMBER() function, plugging it into smd/etc_query:

SELECT * FROM (SELECT *, CEILING(ROW_NUMBER() OVER (ORDER BY date DESC)/10) AS page_num FROM `txp_image`) img WHERE category="sidebar-highlights" LIMIT 12

Offline

#975 2024-10-01 16:09:35

maruchan
Member
From: Ukiah, California
Registered: 2010-06-12
Posts: 595
Website

Re: smd_gallery: super-flexible gallery generator

etc wrote #337908:

If it helps, in MySQL 8 you can use ROW_NUMBER() function, plugging it into smd/etc_query:

SELECT * FROM (SELECT *, CEILING(ROW_NUMBER() OVER (ORDER BY date DESC)/10) AS page_num FROM `txp_image`) img WHERE category="sidebar-highlights" LIMIT 12...

Oh nice! Thank you, I will give this a try.

Last edited by maruchan (2024-10-03 01:24:12)

Offline

Board footer

Powered by FluxBB