Show multiple images from imageid's list

Phoca Gallery plugins - plugins for Phoca Gallery extension
webcreatives
Phoca Newbie
Phoca Newbie
Posts: 4
Joined: 28 Aug 2009, 16:51

Show multiple images from imageid's list

Post by webcreatives »

Would like to share this little modification.

I modified the plugin to make it show multiple images from a comma seperated id list.

In plugins/content/phocagallery.php I changed:

Code: Select all

// Only one image
				if ($imageid > 0) {		
					//$where = ' AND id = '. $imageid;
				}
to

Code: Select all

// Only one image
				if ($imageid > 0) {
					$ids = explode(",",$imageid);
					//$where = ' AND id = '. $imageid;
					$where = ' AND id IN(';
					foreach ($ids as $idvalue) {
							$where .= $idvalue . ',';
					}
					$where = rtrim($where,",") . ")";
				}

Now you can use the plugin like this:

{phocagallery view=category|categoryid=8|imageid=18,20,21}

We needed this feature for one of our customers.
User avatar
caro84g
Phoca Hero
Phoca Hero
Posts: 1369
Joined: 11 Feb 2008, 17:52
Location: Holland
Contact:

Re: Show multiple images from imageid's list

Post by caro84g »

Hi,

thank you for sharing :)

Regards, Carolien
Please ask your support questions in the forums and not via PM - I delete those PM's
Backup before you do any major change to your website (and test first)
xcitan
Phoca Newbie
Phoca Newbie
Posts: 7
Joined: 30 Jun 2009, 13:31

Re: Show multiple images from imageid's list

Post by xcitan »

Perfect, exactly what i needed, and still works fine.

The only thing you meanwhile have to change is from this

Code: Select all

$where = ' AND id IN(';
to this

Code: Select all

  $where = ' AND a.id IN(';
Thanks
Chris
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48386
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Show multiple images from imageid's list

Post by Jan »

Ok
If you find Phoca extensions useful, please support the project
clogg
Phoca Newbie
Phoca Newbie
Posts: 2
Joined: 13 Jan 2015, 18:48

Re: Show multiple images from imageid's list

Post by clogg »

Great hack - simple, safe and makes the gallery plugin even more usefull - I was missing it a lot!
Big thanks to 'webcreatives' for sharing the solution and to Jan for all the work in the project!!
Post Reply