Search

I currently have an iPhone photo site with photo entries. With the photo entries, I have a Subsection Manager link to the Applications section where I can choose which apps I used to create the image.

On my Apps Used page, I am listing all the apps with a count (number) of images that use that app.

Problem is, I'm having to create a data source that creates a param that lists every photo's Apps Used ID. In the XSL, I recursively match the app ID and count how many times it shows up in the param list. It works fine now with a few hundred photos, but if I ever get thousands of photos, it'll start to bog down.

Two things that make this complicated is that I need to be able to filter the photo entries by the "Published" check box and a photo can be linked to more than one app.

Link to page I'm talking about:

http://photobored.joshnichols.com/apps

Is there a better way to do this? Do I need to just make a custom data source?

Thanks!

Attachments:
Screen Shot 2012-05-25 at 10.56.39 PM.png and Screen Shot 2012-05-25 at 10.54.20 PM.png

Could you not create a data source from the Apps section, then tick the "show count of related entries" checkbox. This should add a count of related photos to the XML for example:

<entry id="1" photos="17>
...
</entry>

Ah, just saw:

Two things that make this complicated is that I need to be able to filter the photo entries by the "Published" check box and a photo can be linked to more than one app.

The latter shouldn't matter, but the published checkbox does. Symphony's own count will find all entries, not filtered ones.

In which case I would use a custom data source. Output "system ID" from your Apps data source, so you'd have a param named $ds-apps (or $ds-apps.system-id if you're using Symphony 2.3). Then create a custom data source that reads this array of IDs, iterate over them, then join together the SSM field with the published checkbox field and count the number of entries where IDs match and value is Yes.

The method you're using presently is fine for a few hundred photos, but beyond that it won't scale unless you're happy to cache it.

With the way it is now, I think a custom data source is the best option.

I can also try to create a dynamic XML page with the counts and use that as a data source. Then I can cache that.

If I did remove the published check box, I could try the "show count of related entries", but I'm not able to get it to show the related photos on an app entry. I think that option only goes one way. Is that something fixed in the latest Subsection Manager?

Thanks for the help!

Attachments:
Screen Shot 2012-05-26 at 8.11.13 PM.png and Screen Shot 2012-05-26 at 8.11.03 PM.png

The Subsection Manager only shows related entries one way. I think a custom DS is the way to go.

For now, I set up an xml page that lists the apps and photo count. Then I use that as a Dynamic XML DS and cache it. Now all the pages that need an app count can use that XML file and stay up to date without having to hit the database so much.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details