HeavyEddie
06-11-2006, 12:51 PM
The purpose of this hack is to allow you to display the latest images from an image gallery section with the same name as the category the plugin is placed in.
I wanted to display screen shots for each project that I work on, but really didn't feel like cloning the image gallery, hack this plugin a wee bit and place it on EVERY project page. This allows me to simply slip the plugin to any project page. If there is an image gallery section with the same name... it displays the latest images from there.
Not sure if others will find this useful... but hey, I did :)
Here is what you need to do.
Open p28_latest_images.php and find this near line 12
**global $DB;
Replace it with this code
//! Hack START
**global $DB, $categoryid;
**$thiscatid = $categoryid;
//! Hack END
OK, now finde this code
****$images = $DB->query("SELECT imageid, sectionid, filename, author, title FROM " . TABLE_PREFIX . "p17_images
**************************WHERE activated = '1'".$extraquery." ORDER BY imageid DESC
**************************LIMIT 0, " . ($settings['Number of Images to Display'] + 1) . "");
Replace it with this
//! Hack START
********$catresult = $DB->query("SELECT * FROM " . TABLE_PREFIX . "categories WHERE categoryid = '" . $thiscatid . "'");
********$catname = $DB->fetch_array($catresult);
****$images = $DB->query("SELECT * FROM " . TABLE_PREFIX . "p17_sections as s LEFT JOIN " . TABLE_PREFIX . "p17_images as i ON s.sectionid = i.sectionid WHERE s.name = '" . $catname['name'] . "' ORDER BY i.imageid DESC LIMIT " . ($settings['Number of Images to Display'] + 1));
//! Hack END
Oky doky... thats it.
Thanks to subduck for original... excellent plugin.
I wanted to display screen shots for each project that I work on, but really didn't feel like cloning the image gallery, hack this plugin a wee bit and place it on EVERY project page. This allows me to simply slip the plugin to any project page. If there is an image gallery section with the same name... it displays the latest images from there.
Not sure if others will find this useful... but hey, I did :)
Here is what you need to do.
Open p28_latest_images.php and find this near line 12
**global $DB;
Replace it with this code
//! Hack START
**global $DB, $categoryid;
**$thiscatid = $categoryid;
//! Hack END
OK, now finde this code
****$images = $DB->query("SELECT imageid, sectionid, filename, author, title FROM " . TABLE_PREFIX . "p17_images
**************************WHERE activated = '1'".$extraquery." ORDER BY imageid DESC
**************************LIMIT 0, " . ($settings['Number of Images to Display'] + 1) . "");
Replace it with this
//! Hack START
********$catresult = $DB->query("SELECT * FROM " . TABLE_PREFIX . "categories WHERE categoryid = '" . $thiscatid . "'");
********$catname = $DB->fetch_array($catresult);
****$images = $DB->query("SELECT * FROM " . TABLE_PREFIX . "p17_sections as s LEFT JOIN " . TABLE_PREFIX . "p17_images as i ON s.sectionid = i.sectionid WHERE s.name = '" . $catname['name'] . "' ORDER BY i.imageid DESC LIMIT " . ($settings['Number of Images to Display'] + 1));
//! Hack END
Oky doky... thats it.
Thanks to subduck for original... excellent plugin.