» Log in
User Name:

Password:

Not a member yet?
Register Now!
» Online Users: 64
0 members and 64 guests
No Members online
Most users ever online was 611, 03-21-2008 at 11:10 PM.
» .::.
Web Hosting - web hosting, dedicated servers and web design services
Online Degree - search for 1000+ online degrees, online colleges & online universities.
Tattoo - we are a group of tattoo enthusiasts
Gexa Energy - your absolute best choice in electric service
Texas electricity - save on electric rates
Football Betting - best nfl betting promotions at sportsbook.com.
Oral Chelation - initial cleansing of your veins & arteries
Portatiles - Ofertas en Ordenadores y Portatiles. Increibles Ofertas DELL.

Register Now! Contact Us

About this Page
This is a discussion on Last image Center block for gallery within the Nuke 7.x - Blocks forums, part of the PHP-Nuke 7.x category; Hello, First I have to say great site!! Secondly I am having a coding problem with a block I have. ...


Go Back   Nukemods Forum » PHP-Nuke 7.x » Nuke 7.x - Blocks

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-08-2005, 11:07 PM
Eck Eck is offline
Junior Member
 
Join Date: Apr 2005
Posts: 3
Last image Center block for gallery
Hello,

First I have to say great site!! Secondly I am having a coding problem with a block I have. Its for gallery and it displays 8 to 10 images on two rows. It worked great on my old site until I updated to 7.6 platinum and running v1.4.4-pl6 and now, it tries to work but instead of putting itself in the actual block, It throws all the pictures above the block, the block gives you a message there is nothing to display but, when you click on the picture it takes you to the gallery ok but the the default gallery not what it should do and wrap itself within the site.
I actually think its the way I am linking it now and I have been working on this for two weeks. Would it be ok if I posted the Block here to see if I get some help? Plus this may actually be what some people are looking for.

Thanks
Eck
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-09-2005, 04:14 PM
Eck Eck is offline
Junior Member
 
Join Date: Apr 2005
Posts: 3
Hmm well I see others doing it so I will post mine
This is the code I am using. I just changed the file name to block-lastimage.php and threw it in my blocks folder.

Quote:
global $GALLERY_NO_SESSIONS;
global $GALLERY_BASEDIR;
global $GALLERY_EMBEDDED_INSIDE;
global $GALLERY_MODULENAME;
global $gallery;
$GALLERY_MODULENAME = "Gallery"; //Change this to your module Name
$GALLERY_NO_SESSIONS = true;
$GALLERY_EMBEDDED_INSIDE = "nuke"; //these next two vars were changed by lincles so that
$GALLERY_EMBEDDED_INSIDE_TYPE = "phpnuke"; //this script would work with the gallery init file correctly
//change from postnuke if using other nuke

// Control variables (multiple page display mooted).
$photocount = 8;
$maxphotos = 10;
// You can also comment out the $photocount line above, and add a variable to
// your URL: include.php?type=date&photocount=10 - but if you do this, you need
// to specify the photocount variable when include.php is called, or you'll get
// a divisible by zero error.

$photosperrow = 4;
//this variable and all the table tags below were added by lincles so that the
//block could be a center block and have multiple per row, and have multiple rows.

// Hack prevention.
if (!empty($HTTP_GET_VARS["GALLERY_BASEDIR"]) ||
!empty($HTTP_POST_VARS["GALLERY_BASEDIR"]) ||
!empty($HTTP_COOKIE_VARS["GALLERY_BASEDIR"])) {
print _("Security violation") ."\n";
exit;
}

if (!isset($GALLERY_BASEDIR)) {
$GALLERY_BASEDIR = "/home/yoursitename/public_html/html/modules/gallery/"; //if you are using a url include to include this script,
//change this to ""
}
require_once($GALLERY_BASEDIR . 'init.php');

$borderColor = $gallery->app->default["bordercolor"];
// I set this to a static number for small, 72-pixel thumbnails.
// To use the Gallery default, change this line to the following:
// $thumbSize = $gallery->app->default["thumb_size"];
$thumbSize = 100;
?>

<?php
$navigator["fullWidth"] = 100;
$navigator["widthUnits"] = "%";
$albumDB = new AlbumDB();
$list = $albumDB->albumList;
$numAlbums = count($list);
$skip = array();
for ($i = 0; $i<$numAlbums; $i++) {
$statsAlbum = $list[$i];
if ($statsAlbum->versionOutOfDate()) {
$skip[] = $statsAlbum;
continue;
}
$uid = $gallery->user->getUid();
if ($statsAlbum->canRead($uid) || $gallery->user->isAdmin()) {
$numPhotos = $statsAlbum->numPhotos(1);
for ($j = 1; $j <= $numPhotos; $j++) {
if ( !$statsAlbum->getalbumname($j) )
{
$views = $statsAlbum->getItemClicks($j);
$uploaddate = $statsAlbum->getUploadDate($j);
$arrPhotos[] = array("albumName" => $statsAlbum->fields['name'],
"photoIndex" => $j,
"votes" => $votes,
"views" => $views,
"uploaddate" => $uploaddate);
}
}
}
}
if ( $type == "votes" )
{
usort($arrPhotos, "votesort");
}
else if ( $type == "views" )
{
usort($arrPhotos, "viewsort");
}
else if ( $type == "date" )
{
usort($arrPhotos, "datesort");
}
function votesort($a, $b) {
if ($a['votes'] == $b['votes']) {
return 0;
}
return ($a['votes'] > $b['votes']) ? -1 : 1;
}
function viewsort($a, $b) {
if ($a['views'] == $b['views']) {
return 0;
}
return ($a['views'] > $b['views']) ? -1 : 1;
}
function datesort($a, $b) {
if ($a['uploaddate'] == $b['uploaddate']) {
return 0;
}
return ($a['uploaddate'] > $b['uploaddate']) ? -1 : 1;
}
$uid = $gallery->user->getUid();

if ( !isset($page) )
{
$page = 1;
}
if ( $maxphotos < 0 || $maxphotos > sizeof($arrPhotos))
{
$maxphotos = sizeof($arrPhotos);
}
$startPhoto = ($page - 1) * $photocount;
// Use fuz factor to avoid rounding up when result is 0.5
$lastpage = round( ($maxphotos / $photocount) - 0.500001) + 1;
?>
<table width="100%" cellspacing="0" cellpadding="5"><tr>
<?php
for ($j = $startPhoto; $j < $maxphotos && $j < $startPhoto + $photocount; $j+=1)
{

$photoInfo = $arrPhotos[$j];
for ( $i = 0; $i < $numAlbums; ++$i )
{
if ( !strcmp($photoInfo['albumName'], $list[$i]->fields['name']) )
{
$statsAlbum = $list[$i];
break;
}
}

if (isset($statsAlbum))
{
$photoIndex = $photoInfo['photoIndex'];
$photoId = $statsAlbum->getPhotoId($photoIndex);
if ($statsAlbum->canRead($uid) || $gallery->user->isAdmin())
{
if (!$statsAlbum->isHidden($photoIndex) ||
$statsAlbum->isOwner($uid) ||
$gallery->user->isAdmin())
{
$statsCaption = $statsAlbum->getCaption($photoIndex);
// $statsCaption .= $statsAlbum->getCaptionName($photoIndex);
$statsUrl = makeAlbumUrl($statsAlbum->fields['name'], $photoId);

if (0 == $j%$photosperrow && $startPhoto != $j)
echo '</tr><tr>';
?>
<td align="center">
<?php

$gallery->html_wrap['imageTag'] = $statsAlbum->getThumbnailTag($photoIndex, $thumbSize);
$gallery->html_wrap['imageHref'] = $statsUrl;
$gallery->html_wrap['frame'] = "none";
includeHtmlWrap('inline_gallerythumb.frame');

?>

<?php
$output = "";
if ($statsCaption) {
$output = "
$statsCaption";
}
echo $output;
$output = "
Album: "
."<a href=" .makeAlbumUrl($statsAlbum->fields["name"]) .">"
.$statsAlbum->fields["title"]
."</a></td>";
echo $output;
?>

<?php
}
}
}
}

?>
</tr></table>
<?php
/*
* To call these images from another page on your site, you can use either
* PHP or SSI include calls. In a PHP page, use the command:
*
* <?
* include "http://www.yourdomain.com/gallery/include.php?type=xxxx";
* ?>
*
* In a SHTML page, use the command:
*
*
*
* Change 'xxxx' to your preferred sort type. And remember, you can specify
* for each include the number of images shown by commenting out the $photocount
* variable above and adding it to your include URL. For example:
*
*
*
* ----- The following was added by lincles on 4/8/2004---------
* The following information is using versions:
* postnuke 7.2.6
* gallery 1.4.2
*
* I had troubles with permissions on the photos. When I included this script in the way
* prescribed above, gallery always thought that I was not logged in and would only show
* me pictures viewable by everybody. I found out that this was because all of the
* pnUser functions that postnuke uses to to get user info was not transfered in the
* include. When i changed the include to a file path and set the $type var before the
* include, it fixed this problem. A few other changes were needed was now that it is a
* file include instead of a url, the $GALLERY_BASEDIR had to be set to the dir relitive
* to postnuke, instead of the lastimage.php file. Also the $GALLERY_EMBEDDED_INSIDE value
* was changed to "nuke" and i added $GALLERY_EMBEDDED_INSIDE_TYPE and set it to "postnuke"
* since these are the values that gallery has when running as a module in postnuke. This
* should make it so you only see pictures that you have rights to see and if you have rights
* to see private photos, you see them.
*
* The script in my php block looked like the following
*
* $type = date;
* include('modules/gallery/lastimage.php');
*
* change $type to how you want the pictures sorted - votes,views, or date.
*/
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Image Gallery Thread (nukemods Sig Team) *Dial Up Warning* killerbee Logo requests 4 08-30-2008 06:36 PM
What is the best image Gallery addon for car site? illegalkarma Site design 0 11-10-2005 10:59 PM
Image inside center frame DaiShan Site design 0 06-17-2003 12:07 PM
How can I put a Center Block below the New Stories? rasputin Purged Topics 0 06-15-2003 02:49 AM
background pic on center block GorGonDo Site design 5 04-15-2003 09:40 PM


All times are GMT -5. The time now is 06:12 PM.


Design by Vjacheslav Trushkin, color scheme by ColorizeIt!.

LinkBacks Enabled by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31