Author Topic: [Feature-addon] - Total count for lightbox (how many images you added).  (Read 52930 times)

0 Members and 1 Guest are viewing this topic.

Offline urmasmuld

  • Newbie
  • *
  • Posts: 48
    • View Profile
Re: [Feature-addon] - Total count for lightbox (how many images you added).
« Reply #30 on: November 11, 2009, 01:05:09 PM »
I've tried using this, and for some reason, the page is not refreshing after the first add, only after the second add, so the total is always one less than it should be.

For example, I add the first image to the lightbox, and the count remains 0. As soon as I add the second image to the lightbox, the count goes to 1, but clicking on the lightbox, there are clearly 2 images there. Any idea what is wrong? I've double and triple checked my edits, and all is correct. Using 1.7.7

Same prob. here. Anyone knows how to fix it ?

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [Feature-addon] - Total count for lightbox (how many images you added).
« Reply #31 on: November 11, 2009, 03:15:08 PM »
Remove ALL modifications from step 1 and 1.1

In includes/page_header.php find:
//-----------------------------------------------------
//--- User Box ----------------------------------------
//-----------------------------------------------------


Insert above:
$site_template->register_vars("lightbox_total_count", (empty($user_info['lightbox_image_ids']) ? count(explode(" "trim($user_info['lightbox_image_ids'])))));
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline urmasmuld

  • Newbie
  • *
  • Posts: 48
    • View Profile
Re: [Feature-addon] - Total count for lightbox (how many images you added).
« Reply #32 on: November 25, 2009, 05:24:10 PM »
wow, it works now. Thanx again V@no  :lol:

Offline urmasmuld

  • Newbie
  • *
  • Posts: 48
    • View Profile
Re: [Feature-addon] - Total count for lightbox (how many images you added).
« Reply #33 on: March 22, 2010, 06:35:56 PM »
I have tried installing this : Topic: [Mod] Add/Remove image to/from lightbox without page refresh (2009-07-29)

Is it possible to refresh lightbox count aswell, like this lightbox button ?

EDIT : got it work somehow. It now refreshes whole page, but it wont go top of the page after refresh ;) (EDIT 2: it will work like this in FF only, in IE it goes top of page  :roll:)

changed in functions.php

Code: [Select]
    $lightbox_button = "<a href=\"".$site_sess->url($lightbox_url)."\" onclick=\"this.firstChild.src='".$site_sess->url(ROOT_PATH."lightboxaction.php?id=".$image_row['image_id'])."&ilu='+this.firstChild.src; return false;\"><img src=\"".get_gallery_image("lightbox_yes.gif")."\" border=\"0\" alt=\"\" /></a>";

to this
Code: [Select]
    $lightbox_button = "<a href=\"".$site_sess->url($lightbox_url)."\" onclick=\"this.firstChild.src='".$site_sess->url(ROOT_PATH."lightboxaction.php?id=".$image_row['image_id'])."&ilu='+this.firstChild.src; window.location.reload(); return false;\"><img src=\"".get_gallery_image("lightbox_yes.gif")."\" border=\"0\" alt=\"\" /></a>";

and this code

Code: [Select]
    $lightbox_button = "<a href=\"".$site_sess->url($lightbox_url)."\" onclick=\"this.firstChild.src='".$site_sess->url(ROOT_PATH."lightboxaction.php?id=".$image_row['image_id'])."&ilu='+this.firstChild.src; return false;\"><img src=\"".get_gallery_image("lightbox_no.gif")."\" border=\"0\" alt=\"\" /></a>";

into this :

Code: [Select]
    $lightbox_button = "<a href=\"".$site_sess->url($lightbox_url)."\" onclick=\"this.firstChild.src='".$site_sess->url(ROOT_PATH."lightboxaction.php?id=".$image_row['image_id'])."&ilu='+this.firstChild.src; window.location.reload(); return false;\"><img src=\"".get_gallery_image("lightbox_no.gif")."\" border=\"0\" alt=\"\" /></a>";

tried to surround {lightbox_total_count} with DIV tags, but refreshing DIV needs another page inside DIV (ex. lightbox_total_count.php), as I understand. If we could make a page which showing {lightbox_total_count} inside it would be cool and then could refresh it without refreshing whole page.

EDIT3 : got it to work ;)
« Last Edit: April 06, 2010, 08:26:52 AM by urmasmuld »

Offline Geezer

  • Newbie
  • *
  • Posts: 22
    • View Profile
Remove ALL modifications from step 1 and 1.1

In includes/page_header.php find:
//-----------------------------------------------------
//--- User Box ----------------------------------------
//-----------------------------------------------------


Insert above:
$site_template->register_vars("lightbox_total_count", (empty($user_info['lightbox_image_ids']) ? count(explode(" "trim($user_info['lightbox_image_ids'])))));



Does it work with uploads? I have in the Userbox "uploads" and i need it.

« Last Edit: June 05, 2015, 08:29:26 PM by Geezer »

Offline Geezer

  • Newbie
  • *
  • Posts: 22
    • View Profile
means no answer that it does not work??

Rembrandt

  • Guest
means no answer that it does not work??
What do you want, this Mod count only the Images from Lightbox and display it in the User Box.

Offline Geezer

  • Newbie
  • *
  • Posts: 22
    • View Profile
I have in Userbox also upload (see image).  there I would also like the counter
« Last Edit: June 11, 2015, 06:33:38 PM by Geezer »

Rembrandt

  • Guest
search in includes/page_header.php:

if (isset($array[$file])) {
  
$array[$file] = true;
}

insert above:

 
//############## Start Count User Images ############
    
$sql "SELECT COUNT(image_id) AS sum_images
            FROM "
.IMAGES_TABLE."
            WHERE image_active = 1  AND user_id = "
.$user_info['user_id']."
            "
;
    
$sum_images $site_db->query_firstrow($sql);
//############## End Count Images ################### 

search:

$site_template
->register_vars(array(
  
"home_url"  => ROOT_PATH,

insert below:

   
"count_user_images" => $sum_images['sum_images'],

in "your template/user_logininfo.html", wherever you want :
Code: [Select]
{count_user_images}