Hello!
This little modification i`ve created for my gallery. I think it might be useful to someone else!
Q: What is that modification do?
A: This mod, will count the number of hits for each album and record the value in the database every time someone would see the photo album. Just 4 steps for modification. P.S. This work in all versions of 4images, and not depends on each installed MODs..
1. Create a table in 4images_lightboxes
ALTER TABLE `4images_lightboxes` ADD `lightbox_hits` INT(10) UNSIGNED AS DEFINED 0;2. In lightbox.php find
//-----------------------------------------------------
//--- Show Images -------------------------------------
//-----------------------------------------------------
if ($action == "show")
{Add after:
//Update lightbox Hits
if ($user_info['user_level'] != ADMIN) {
$lightbox_id = (isset($HTTP_POST_VARS['lightbox_id']) && $HTTP_POST_VARS['lightbox_id']) ? $HTTP_POST_VARS['lightbox_id'] : ((isset($HTTP_GET_VARS['lightbox_id']) && $HTTP_GET_VARS['lightbox_id']) ? $HTTP_GET_VARS['lightbox_id'] : 0);
$sql = "UPDATE ".LIGHTBOXES_TABLE." l
SET l.lightbox_hits = l.lightbox_hits + 1
WHERE l.lightbox_id = '".$lightbox_id."'";
$site_db->query($sql);
}3: Directly under 2 step, find sql query and at the end of line paste:
, l.lightbox_hits4. Find:
$site_template->register_vars(array(Paste:
"lightbox_hits" => $row['lightbox_hits'],5. In the lightbox.html use {lightbox_hits}
This is end! Take a look! Enjoy
Regards,
Andrew