Support Forums | Demo Gallery [1.x] [2.x] | Downloads | News | Site Map ]
Nuked Gallery
  Create a FREE account or Login   As a guest, you don't have access to our FULL navigation system.
 Forum FAQForum FAQ   StatisticsStatistics   SearchSearch   UsergroupsUsergroups   FavoritesFavorites  

Image Count

 
Post new topic   Reply to topic    NukedGallery.net Forum Index » PHP-Nuke Integration » Other PHPNuke Issues View previous topicPrinter friendly versionView next topic
Author Message
ihateregistering

Beginner
Beginner


Joined: Sep 16, 2003
Posts: 3

PostPosted: Sat May 08, 2004 1:17 pm    Post subject: Image Count Reply with quote

How can I get the number of images in an album to appear in another PHPNuke page?
What I'm trying to do is set up a page so when a visitor clicks on an item they can get information including how many images are in the album for that item. The item name and album name would be the same.
Also in this regard is there a way to get the total amount of pictures in my Gallery? I would like to add this to a Content Total Block that currently has the total amount of stories, topics, downloads etc.

Any and all help would be appreciated.
Back to top
Offline View user's profile Send private message
AdBot
   Post subject: Image Count  

Back to top
dari

Site Admin
Site Admin


Joined: Mar 03, 2003
Posts: 6284
Location: Washington Township, NJ, USA

PostPosted: Mon May 10, 2004 7:20 am    Post subject: Re: Image Count Reply with quote

i'm not quite clear what you're asking for here...do you want a block that lists the albums and the number of photos in each of them? or do you want a header/footer on your nuke page that lists this information?
_________________
Back to top
Offline View user's profile Send private message Visit poster's website
ihateregistering

Beginner
Beginner


Joined: Sep 16, 2003
Posts: 3

PostPosted: Wed May 19, 2004 3:03 am    Post subject: Re: Image Count Reply with quote

Sort of both. There is a block for PHPNuke called Content Totals which gives the total stories, downloads, weblinks and I would like to add to it a little script to get the total amount of photos that are in Gallery. Here is the code for the content block and in it I would like to be able to add Photos: and the total number of photos in my Gallery.

Code: ›
<?php
########################################################################
# PHP-Nuke Block: Total Content v1.0                                   #
#                                                                      #
# Copyright (c) 2002 by D.Siguenza (pcguy@pctechforums.com)            #
#                                                                      #
########################################################################
# This program is free software. You can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License.       #
########################################################################

if (eregi("block-Content_Totals.php", $PHP_SELF)) {
    Header("Location: index.html");
    die();
}

global $nukeurl, $prefix, $dbi;

$snum = sql_num_rows(sql_query("select * from ".$prefix."_stories", $dbi), $dbi);
$tnum = sql_num_rows(sql_query("select * from ".$prefix."_topics where active=1", $dbi), $dbi);
$dresult = sql_query("SELECT count(*) as num FROM ".$prefix."_downloads_downloads", $dbi);
$dnum = mysql_result($dresult,0,"num");
$wresult = sql_query("SELECT count(*) as num FROM ".$prefix."_links_links", $dbi);
$wnum = mysql_result($wresult,0,"num");

if ($dnum == 0){
$downloads = "No downloads available";
}else{
$downloads = "Downloads: <font color=red>$dnum</font>";
}

if ($wnum == 0){
$links = "No links available";
}else{
$links = "Weblinks: <font color=red>$wnum</font>";
}

if ($snum == 0) {
$snum1 = "No stories available";
}else{
$snum1 = "News Articles: <font color=red>$snum</font>";
}

if ($tnum == 0) {
$tnum1 = "No active topics available";
}else{
$tnum = "Active Topics: <font color=red>$tnum</font>";
}

$content = "Available Content<br><br>$tnum<br>$downloads<br>$snum1<br>$links<br>";

?>


Now the second one might be harder. I have incorporated into my PHPNuke a database of items. When one clicks on a link to the item they get a bunch of info for that item i.e. size, colour, price. etc. I would like to add another script that would give the total amount of pictures for that items album. Now the id number of the item is the same as the album name so it makes it easier to call.
So if one clicked on item xyz that has an id of 23 then they get get all the info for item xyz and how many photos in album 23
Back to top
Offline View user's profile Send private message
dari

Site Admin
Site Admin


Joined: Mar 03, 2003
Posts: 6284
Location: Washington Township, NJ, USA

PostPosted: Thu May 20, 2004 7:55 pm    Post subject: Re: Image Count Reply with quote

hmm...well there is a portion of code in gallery that displays the total number of images (go to the gallery here, and it'll say X images in X albums...)....i think the code is:

PHP: › <?php // you might not need this line
global $gallery;
$albumDB = new AlbumDB(FALSE);
$numPhotos $albumDB->getCachedNumPhotos($gallery->user);
echo 
"Photos: ".$numPhotos?>

_________________
Back to top
Offline View user's profile Send private message Visit poster's website
ihateregistering

Beginner
Beginner


Joined: Sep 16, 2003
Posts: 3

PostPosted: Fri May 21, 2004 1:12 am    Post subject: Re: Image Count Reply with quote

Excellent!!!!! Worked like a charm.
Here is the code I use for a block that has totals in PHPNuke

Call the block block-Content_Totals.php and place in your blocks directory under PHPNuke

Code: ›
<?php
########################################################################
# PHP-Nuke Block: Total Content v1.0                                   #
#                                                                      #
# Copyright (c) 2002 by D.Siguenza (pcguy@pctechforums.com)            #
#                                                                      #
########################################################################
# This program is free software. You can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License.       #
########################################################################

if (eregi("block-Content_Totals.php", $PHP_SELF)) {
    Header("Location: index.html");
    die();
}

global $nukeurl, $prefix, $dbi;

$snum = sql_num_rows(sql_query("select * from hobby_stories", $dbi), $dbi);
$tnum = sql_num_rows(sql_query("select * from ".$prefix."_topics where active=1", $dbi), $dbi);
$dresult = sql_query("SELECT count(*) as num FROM ".$prefix."_downloads_downloads", $dbi);
$dnum = mysql_result($dresult,0,"num");
$wresult = sql_query("SELECT count(*) as num FROM ".$prefix."_links_links", $dbi);
$wnum = mysql_result($wresult,0,"num");
// you might not need this line
global $gallery;
$albumDB = new AlbumDB(FALSE);
$pnum = $albumDB->getCachedNumPhotos($gallery->user);

if ($dnum == 0){
$downloads = "No downloads available";
}else{
$downloads = "Downloads: <font color=red>$dnum</font>";
}

if ($wnum == 0){
$links = "No links available";
}else{
$links = "Weblinks: <font color=red>$wnum</font>";
}

if ($snum == 0) {
$snum1 = "No stories available";
}else{
$snum1 = "News Articles: <font color=red>$snum</font>";
}

if ($tnum == 0) {
$tnum1 = "No active topics available";
}else{
$tnum1 = "Active Topics: <font color=red>$tnum</font>";
}

if ($pnum == 0) {
$pnum1 = "No active topics available";
}else{
$pnum1 = "Photos Online: <font color=red>$pnum</font>";
}

$content = "Available Content<br><br>$tnum1<br>$downloads<br>$snum1<br>$links<br>$pnum1<br>";

?>


Now I have to figure how how to do the same thing for an album. If I know the album name is 333 then how do I call the number of photos in album 333. The only thing I can come up with is this

Code: ›
list ($numPhotos, $numAlbums) = $gallery->album->numVisibleItems($gallery->user);


Would I change album to the variable (333)?
This has got me real confused. I have limited knowledge of PHP but cna adapt most code in Nuke but in Gallery the code really messes with my mind. Any help again will be greatly appreciated.
Back to top
Offline View user's profile Send private message
dari

Site Admin
Site Admin


Joined: Mar 03, 2003
Posts: 6284
Location: Washington Township, NJ, USA

PostPosted: Fri May 21, 2004 7:12 am    Post subject: Re: Image Count Reply with quote

yup, that's the proper code...you'd just have to add in something like this before:

PHP: › <?php // you may not need this line:
global $gallery;
foreach(
$albumDB->albumList as $album) {
        
$albumName $album->fields['name'];
        
$tmpalbum = new Album();
        
$tmpalbum->load($albumName);
        list (
$numPhotos$numAlbums) = $tmpalbum->numVisibleItems($gallery->user);
        echo 
$albumName." : ".$numPhotos."<br>";
?>


this will cycle through your entire gallery, printing the name of each album with the number of photos in them.
_________________
Back to top
Offline View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    NukedGallery.net Forum Index » PHP-Nuke Integration » Other PHPNuke Issues View previous topicPrinter friendly versionView next topic

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours

Powered by phpBB © phpBB Group



Sponsors: Web HostingDedicated ServersDomain NamesDomain Name RegistrationDedicated Web HostingSEO Search Engine OptimisationSEOWeb Design New YorkSEO Web DesignWeb hosting AustraliaCheap Web Design

6th year online! 2003-2009
Legal • Use of this site consitutes agreement to the Acceptable Use Policy
Hosted by Implosion WorksSourceForge.net Logo • Theme by TonicMedia