Re: DISPLAYING LISTS based on fields

10 posts by 2 authors in: Forums > CMS Builder
Last Post: February 12, 2015   (RSS)

By claire - December 23, 2014

Hey there

This looks like you're only loading a single record here, not multiple subcategory photos. What does the structure of the bird_photos section look like, and what should the page look like?

--------------------

Claire Ryan
interactivetools.com

Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

On that subcategory page - I do want it to be a single record - the first image that has been checked for that subcategory. For instance, whatever the last "bird of prey" image is - I would like that to show up as a single image with a static link that I will set - which will go to the main Birds of Prey Gallery.  Same for Songbirds, Waterbirds, View All Birds, etc.  And then I'm doing the same thing with Mammals (small mammals & large mammals) 

Each subcategory will have 1 image showing on this subcategory page ( http://www.billdraker.com/bird-photography-subcats.php ) and then link to the corresponding subcat galleries below:

http://www.billdraker.com/bird-songbird-photography.php
http://www.billdraker.com/bird-waterbird-photography.php
http://www.billdraker.com/bird-birdsofprey-photography.php
http://www.billdraker.com/bird-allotherbirds-photography.php

http://www.billdraker.com/mammal-small-photography.php
http://www.billdraker.com/mammal-large-photography.php

Does that help explain it? 

Thanks, Claire! 

By claire - December 24, 2014

Yeah, this explains it better, although I think you've got a case of over-engineering going on here. All the individual category pages are the same, so you don't need to have separate viewer files for each one.

So there's a table called bird_photos - is the category stored in that? And what does the category field look like, if so?

--------------------

Claire Ryan
interactivetools.com

Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Hello Claire, 

Sorry for taking so long to follow up on this! 

Yes, there is a table called bird_photos and ALL birds were already entered into it when the client decided they wanted them easily divided into subcategories (Songbirds, Waterbirds, Birds of Prey, All Other Birds) 

I've included a screenshot of  of section editor & editor pages.  I'm also attaching my revised php page. I have managed to make something that resembles progress. Here's the page link: 

http://www.billdraker.com/bird-photography-subcats.php

in the Load records section - whichever record I put this line after - makes the first image of that subcategory appear as the first image and the last image. The first image is not supposed to be displaying a subcategory image, but rather the first image of the main gallery (ALL birds) 

    $bird_photosRecord = @$bird_photosRecords[0]; // get first record

If each thumbnail pulled the first image from the appropriate subcategory (Songbirds, Waterbirds, Birds of Prey & All Other Birds) - then that's all I'm trying to achieve.  

Does this help? I sure hope so!!  Thank you for your help! Tina

By claire - February 2, 2015

Hi Tina

I think the actual structure - multiple getRecords calls to get the first in each subcategory - is the simplest solution. You're just missing a few key variable names.

I've amended the file - see attached. It's untested, but I really just cleaned up some of the code.

--------------------

Claire Ryan
interactivetools.com

Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

By claire - February 2, 2015

Sorry, the file wasn't attached. Here it is now.

--------------------

Claire Ryan
interactivetools.com

Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Claire, has anyone told you how awesome  you are today??!!!  Thanks so much!  :) 

By claire - February 12, 2015

No problem :) let us know if you need any more help.

--------------------

Claire Ryan
interactivetools.com

Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Thank you! This one works great and I changed the "view all photos" thumbnail to pull a random image so none of the thumbs on the subcat page would be duplicated.