Author Topic: List total number of new images as a figure?  (Read 7249 times)

0 Members and 1 Guest are viewing this topic.

Offline diego777

  • Pre-Newbie
  • Posts: 4
    • View Profile
List total number of new images as a figure?
« on: June 17, 2003, 08:19:56 PM »
Is there a simple way of doing this?

I just want some way of counting the total  new images & can be put on my home page to say -


  ' 5 new images in gallery ' (or whatever number)


just for the NEW images, not the total number of images on my site.

Offline Apollo13

  • Addicted member
  • ******
  • Posts: 1.093
    • View Profile
List total number of new images as a figure?
« Reply #1 on: June 17, 2003, 09:07:34 PM »
well u can use this. There are some other stats 2. Look at my site GAllery Stats.

Code: [Select]

//-----------------------------------------------------
//--- Gallery Stats Box -------------------------------
//-----------------------------------------------------
//User
$sql = "SELECT COUNT(*) as users FROM ".USERS_TABLE." WHERE user_id <> ".GUEST;
$row = $site_db->query_firstrow($sql);
$total_users = "".$lang['users']."<B> <a href=\"".$site_sess->url(ROOT_PATH."memberlist.php")."\">".$row['users']."</B></a>";
//Hits
$sql1 = "SELECT SUM(cat_hits) AS hits FROM ".CATEGORIES_TABLE;
$row1 = $site_db->query_firstrow($sql1);
$sql = "SELECT SUM(image_hits) AS sum FROM ".IMAGES_TABLE;
$row = $site_db->query_firstrow($sql);
$hits_total = $row['sum']+$row1['hits'];
$total_hits = "".$lang['total_hits']."<B> ".$hits_total."</B>\n";
//Votes
$sql = "SELECT SUM(image_votes) AS sum FROM ".IMAGES_TABLE;
$row = $site_db->query_firstrow($sql);
$total_votes = "".$lang['total_votes']."<B> ".$row['sum']."</B>\n";
//Downloads
$sql = "SELECT SUM(image_downloads) AS sum FROM ".IMAGES_TABLE;
$row = $site_db->query_firstrow($sql);
$total_downloads = "".$lang['total_downloads']."<B> ".$row['sum']."</B>\n";
//Comments
$sql = "SELECT SUM(image_comments) AS sum FROM ".IMAGES_TABLE;
$row = $site_db->query_firstrow($sql);
$total_comments = "".$lang['total_comments']."<B> ".$row['sum']."</B>\n";
//New Images
$cutoff  = time() - 86400 * $config['new_cutoff'];
$sql = "SELECT * FROM ".IMAGES_TABLE." WHERE (image_active = 1) AND (image_date >= ".$cutoff.")";
$result = $site_db->query($sql);
$images_new = $site_db->get_numrows($result);
$total_images_new = "".$lang['total_new_images']."<b> <a href=\"".$site_sess->url(ROOT_PATH."search.php?search_new_images=1")."\">".$images_new."</b></a>";
//register
$gallery_stats_box = $site_template->parse_template("gallery_stats_box");
  $site_template->register_vars(array(
    "gallery_stats_box" => $gallery_stats_box,
"total_users" => $total_users,
"total_hits" => $total_hits,
"total_votes" => $total_votes,
"total_downloads" => $total_downloads,
"total_comments" => $total_comments,
"images_total" => $lang['total_images'],
"total_cats" => $lang['total_cats'],
"total_images_new" => $total_images_new
  ));
  unset($gallery_stats_box);
  unset($images_new);
  unset($total_cats);
  unset($total_images);
  unset($total_comments);
  unset($total_downloads);
  unset($total_votes);
  unset($total_hits);
  unset($total_users);

Offline SLL

  • Hero Member
  • *****
  • Posts: 585
    • View Profile
List total number of new images as a figure?
« Reply #2 on: June 17, 2003, 10:25:34 PM »
http://faces.dalnet.ru/files.php?action=download&id=6
sorry, not documented at all, but it's very simple

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
List total number of new images as a figure?
« Reply #3 on: June 17, 2003, 11:46:13 PM »
to show only number of new images replace in index.php (or any others "main" files):
Code: [Select]
//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$site_template->register_vars(array(
with this:
Code: [Select]
$new_images_count = 0;
foreach ($new_image_cache as $key => $val) {
if ($val && check_permission("auth_viewcat", $key)) {
$new_images_count += $val;
}
}
//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$site_template->register_vars(array(
"new_images_count" => $new_images_count,


P.S. to use this code, make sure u have define('GET_CACHES', 1); on top of the "main" file u are insert code above.
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 diego777

  • Pre-Newbie
  • Posts: 4
    • View Profile
List total number of new images as a figure?
« Reply #4 on: June 18, 2003, 10:12:22 AM »
O.K. Thanks guys, but what I'm looking for is something really simple -

Just that I can put on my homepage (not the 4images homepage) that's a counter for the total figure of newly uploaded images.

If you look at this page - http://pool.dylantree.com - they're running such a counter on their front page. They're not running 4images, but the principle must be the same, I guess...

Offline gifwav

  • Newbie
  • *
  • Posts: 37
    • View Profile
    • http://www.funpics4u.com
Re: List total number of new images as a figure?
« Reply #5 on: April 26, 2006, 10:07:37 PM »
Hi,

I'm using the solution of Vano and it works well on the php files with main templates like home, details, categories etc.
But I've also created some custom template pages, which I link by using a URL like "index.php?template=memory".
On this pages I see: New images ().
How can I get this to work?

Thanks.

Jan

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: List total number of new images as a figure?
« Reply #6 on: April 27, 2006, 01:10:06 AM »
In index.php remove all the changes from this thread
Then find:
Code: [Select]
$user_access = get_permission();Insert below:
Code: [Select]
$new_images_count = 0;
foreach ($new_image_cache as $key => $val)
{
  if ($val && check_permission("auth_viewcat", $key))
  {
    $new_images_count += $val;
  }
}
$site_template->register_vars("new_images_count", $new_images_count);
« Last Edit: April 27, 2006, 11:39:59 AM by V@no »
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 gifwav

  • Newbie
  • *
  • Posts: 37
    • View Profile
    • http://www.funpics4u.com
Re: List total number of new images as a figure?
« Reply #7 on: April 27, 2006, 09:19:23 AM »
Thank you V@no for your quick reply.
It works!

Jan