Last Picture Block - 2 rows
Go to page 1, 2  Next  :| |:
-> Coppermine

#1: Last Picture Block - 2 rows Author: WebSiteGuru PostPosted: Fri Sep 14, 2007 3:11 pm
    ----
How can I make it to where the Last picture block will show 2 rows instead of 1?

#2: Re: Last Picture Block - 2 rows Author: NanoCaiordoLocation: Melbourne, AU PostPosted: Fri Sep 14, 2007 4:16 pm
    ----
Are you talking about the Last Picture block at the bottom of coppermine index page or a file-block inside blocks/ directory?

#3: Re: Last Picture Block - 2 rows Author: WebSiteGuru PostPosted: Fri Sep 14, 2007 5:44 pm
    ----
I am talking about file-block inside blocks/ directory. Thanks for responding pretty fast. Very Happy

#4: Re: Last Picture Block - 2 rows Author: NanoCaiordoLocation: Melbourne, AU PostPosted: Sat Sep 15, 2007 2:33 am
    ----
If you are talking about block-CPG-center-Last_pictures_thumb.php the number of pictures is coming from a coppermine wide configuration $CONFIG['thumbcols'] "number of thumbnails for row".

However if you only want to modify the block and not the entire coppermine then you can try the following inside the block:

$length = 8;
$rows = 2;
.....
$pic++;
if ($length/$rows == $pic) $content .= '</tr><tr>';

#5: Re: Last Picture Block - 2 rows Author: WebSiteGuru PostPosted: Tue Sep 18, 2007 3:46 pm
    ----
NanoCaiordo wrote:

However if you only want to modify the block and not the entire coppermine then you can try the following inside the block:

$length = 8;
$rows = 2;

.....
$pic++;
if ($length/$rows == $pic) $content .= '</tr><tr>';

OK! I understand that I have to edit the block add the bold in red info in. But I am confused to where it goes. I had tried to put it in the area indicated below in bold red, it it still not showing 2 rows in the blocks.

Quote::
if (!defined('CPG_NUKE')) { exit; }
global $prefix, $db, $CONFIG, $cpg_dir;
$cpg_dir = "coppermine";

if (!is_active($cpg_dir)) {
$content = 'ERROR';
return trigger_error($cpg_dir.' module is inactive', E_USER_WARNING);
}

$cpg_block = true;
require("modules/" . $cpg_dir . "/include/load.inc");
$cpg_block = false;
$length = $CONFIG['thumbcols']; //number of thumbs
// $length=4; //number of thumbs
$length = 8;
$rows = 2;

$content = $thumb_title = '';
$result = $db->sql_query("SELECT pid, filepath, filename, p.aid, p.title FROM ".$cpg_prefix."pictures AS p INNER JOIN ".$cpg_prefix."albums AS a ON (p.aid = a.aid AND ".VIS_GROUPS.") WHERE approved=1 GROUP BY pid ORDER BY pid DESC LIMIT $length");
$content .= '<br /><table width="100%" border="0" cellpadding="0" cellspacing="0" align="center"><tr align="center">';
$pic = 0;
while ($row = $db->sql_fetchrow($result)) {
if ($CONFIG['seo_alts'] == 0) {
$thumb_title = $row['filename'];
} else {
if ($row['title'] != '') {
$thumb_title = $row['title'];
} else {
$thumb_title = substr($row['filename'], 0, -4);
}
}
$content .= '<td align="center" valign="baseline"><a href="' . getlink($cpg_dir . '&amp;file=displayimage&amp;meta=lastup&amp;cat=0&amp;pos=' . $pic) . '"><img src="' . get_pic_url($row, 'thumb') . '" border="0" alt="' . $thumb_title . '" title="' . $thumb_title . '" /><br />' . truncate_stringblocks($thumb_title) . '</a></td>';
$pic++;
}
if ($length/$rows == $pic) $content .= '</tr><tr align="center"><td colspan="' . $length . '" valign="baseline"><a href="' . getlink($cpg_dir) . '">' . _coppermineLANG . '</a><br /></td></tr></table>';

Can you explain more on this? Thanks! Big grin

#6: Re: Last Picture Block - 2 rows Author: NanoCaiordoLocation: Melbourne, AU PostPosted: Tue Sep 18, 2007 3:56 pm
    ----
PHP:
  $pic++;
}
if (
$length/$rows == $pic) $content .= '</tr><tr align="center"><td colspan="' . $length . '" valign="baseline"><a href="' .
wrong
PHP:
  $pic++;
if (
$length/$rows == $pic) $content .= '</tr><tr>';
}
$content .= '</tr><tr> ...the original code...';
correct

#7: Re: Last Picture Block - 2 rows Author: WebSiteGuru PostPosted: Tue Sep 18, 2007 4:53 pm
    ----
Oh! OKKIE! Thanks! Big grin Embarassed Now I feel stupid. Wink Shocked

#8: Re: Last Picture Block - 2 rows Author: NanoCaiordoLocation: Melbourne, AU PostPosted: Tue Sep 18, 2007 4:56 pm
    ----
My bad, instructions were not that clear, but at least we got it working Smile

#9: Re: Last Picture Block - 2 rows Author: WebSiteGuru PostPosted: Tue Sep 18, 2007 5:01 pm
    ----
I still have to try it tonight when I get home, since I dont have access to the server from work. Wink I'll come back with the results. Very Happy

#10: Re: Last Picture Block - 2 rows Author: WebSiteGuru PostPosted: Wed Sep 19, 2007 4:48 am
    ----
OK! It works now, with minor detail spacing. I'll try to figure that one out.

#11: Re: Last Picture Block - 2 rows Author: WebSiteGuru PostPosted: Wed Sep 19, 2007 2:28 pm
    ----
All Done Thanks Nano. Very Happy Kudos for you. Wink

#12: Re: Last Picture Block - 2 rows Author: 3DdesktopsUKLocation: Surrey - UK PostPosted: Sat Apr 12, 2008 9:07 am
    ----
Hi guys, just copied the code to impliment on my site but the second row is not showing - any ideas what I have done wrong?

Many thanks in advance...

PHP:
<?php
/*********************************************
CPG Dragonfly™ CMS
********************************************
Copyright © 2004 - 2005 by CPG-Nuke Dev Team
www.dragonflycms.com

Dragonfly is released under the terms and conditions
of the GNU GPL version 2 or any later version

$Source: /cvs/html/blocks/block-CPG-Last_pictures_thumb.php,v $
$Revision: 9.6 $
$Author: djmaze $
$Date: 2006/01/16 12:19:32 $
Encoding test: n-array summation ? latin ae w/ acute ?
********************************************************/
if (!defined('CPG_NUKE')) { exit; }
global
$prefix, $db, $CONFIG, $cpg_dir;
$cpg_dir = "coppermine";

if (!
is_active($cpg_dir)) {
$content = 'ERROR';
return
trigger_error($cpg_dir.' module is inactive', E_USER_WARNING);
}

$cpg_block = true;
require(
"modules/" . $cpg_dir . "/include/load.inc");
$cpg_block = false;
$length = $CONFIG['thumbcols']; //number of thumbs
// $length=4; //number of thumbs
$length=3;
$rows=2;
$content = $thumb_title = '';
$result = $db->sql_query("SELECT pid, filepath, filename, p.aid, p.title FROM ".$cpg_prefix."pictures AS p INNER JOIN ".$cpg_prefix."albums AS a ON (p.aid = a.aid AND ".VIS_GROUPS.") WHERE approved=1 GROUP BY pid ORDER BY pid DESC LIMIT $length");
$content .= '<br /><table width="100%" border="0" cellpadding="0" cellspacing="0" align="center"><tr align="center">';
$pic = 0;
while (
$row = $db->sql_fetchrow($result)) {
if (
$CONFIG['seo_alts'] == 0) {
$thumb_title = $row['filename'];
} else {
if (
$row['title'] != '') {
$thumb_title = $row['title'];
} else {
$thumb_title = substr($row['filename'], 0, -4);
}
}
$content .= '<td align="center" valign="baseline"><a href="' . getlink($cpg_dir . '&amp;file=displayimage&amp;meta=lastup&amp;cat=0&amp;pos=' . $pic) . '"><img src="' . get_pic_url($row, 'thumb') . '" border="0" alt="' . $thumb_title . '" title="' . $thumb_title . '" /><br />' . truncate_stringblocks($thumb_title) . '</a></td>';
$pic++;
if (
$length/$rows == $pic) $content .= '</tr><tr>';
}
$content .= '</tr><tr><tr align="center"></td></tr></table>';

The first row still shows -

>> My Test Site

#13: Re: Last Picture Block - 2 rows Author: rlguraLocation: Cleveland, OH USA PostPosted: Sat Apr 12, 2008 4:43 pm
    ----
$length is the total number of pictures - in your case it should be 6

#14: Re: Last Picture Block - 2 rows Author: 3DdesktopsUKLocation: Surrey - UK PostPosted: Sat Apr 12, 2008 9:53 pm
    ----
that's great!! o der me lol!!!

Thanks rlgura

#15: Re: Last Picture Block - 2 rows Author: 3DdesktopsUKLocation: Surrey - UK PostPosted: Mon Jun 09, 2008 8:21 am
    ----
hi, just playing around with this again and tried to display 12 thumbs (3 wide / 4 deep) and although it does display the 12, it doesn't wrap on the second line. like so:

xxx
xxxxxxxxx

opposed to

xxx
xxx
xxx
xxx

is there something I am missing again. Thanks in advance.



-> Coppermine

All times are GMT

Go to page 1, 2  Next  :| |:
Page 1 of 2