Last Picture Block - 2 rows
Post new topic   Reply to topic   Printer Friendly Page     Forum IndexCoppermine
Author Message
WebSiteGuru
1000+ Posts Club


Joined: Jun 09, 2005
Posts: 2321

PostPost subject: Last Picture Block - 2 rows
Posted: Fri Sep 14, 2007 3:11 pm
Reply with quote

How can I make it to where the Last picture block will show 2 rows instead of 1?
_________________
Lead Theme Designer - WebSiteGuru Designs

WebSiteGuru's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux 2.6.9 / Apache 2.2.6 / MySQL 5.0.27 / PHP 5 / DF Version 9.2.1
Back to top
View user's profile Visit poster's website Yahoo Messenger
NanoCaiordo
Developer


Joined: Jun 29, 2004
Posts: 3677
Location: Melbourne, AU

PostPost subject: Re: Last Picture Block - 2 rows
Posted: Fri Sep 14, 2007 4:16 pm
Reply with quote

Are you talking about the Last Picture block at the bottom of coppermine index page or a file-block inside blocks/ directory?
_________________
.:: I met php the 03 December 2003 :: Unforgettable day! ::.

NanoCaiordo's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
MySQL 5.1 / PHP 5.3 / NextGen()
Back to top
View user's profile Visit poster's website
WebSiteGuru
1000+ Posts Club


Joined: Jun 09, 2005
Posts: 2321

PostPost subject: Re: Last Picture Block - 2 rows
Posted: Fri Sep 14, 2007 5:44 pm
Reply with quote

I am talking about file-block inside blocks/ directory. Thanks for responding pretty fast. Very Happy
_________________
Lead Theme Designer - WebSiteGuru Designs

WebSiteGuru's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux 2.6.9 / Apache 2.2.6 / MySQL 5.0.27 / PHP 5 / DF Version 9.2.1
Back to top
View user's profile Visit poster's website Yahoo Messenger
NanoCaiordo
Developer


Joined: Jun 29, 2004
Posts: 3677
Location: Melbourne, AU

PostPost subject: Re: Last Picture Block - 2 rows
Posted: Sat Sep 15, 2007 2:33 am
Reply with quote

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>';

_________________
.:: I met php the 03 December 2003 :: Unforgettable day! ::.

NanoCaiordo's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
MySQL 5.1 / PHP 5.3 / NextGen()
Back to top
View user's profile Visit poster's website
WebSiteGuru
1000+ Posts Club


Joined: Jun 09, 2005
Posts: 2321

PostPost subject: Re: Last Picture Block - 2 rows
Posted: Tue Sep 18, 2007 3:46 pm
Reply with quote

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

_________________
Lead Theme Designer - WebSiteGuru Designs

WebSiteGuru's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux 2.6.9 / Apache 2.2.6 / MySQL 5.0.27 / PHP 5 / DF Version 9.2.1
Back to top
View user's profile Visit poster's website Yahoo Messenger
NanoCaiordo
Developer


Joined: Jun 29, 2004
Posts: 3677
Location: Melbourne, AU

PostPost subject: Re: Last Picture Block - 2 rows
Posted: Tue Sep 18, 2007 3:56 pm
Reply with quote

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

_________________
.:: I met php the 03 December 2003 :: Unforgettable day! ::.

NanoCaiordo's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
MySQL 5.1 / PHP 5.3 / NextGen()
Back to top
View user's profile Visit poster's website
WebSiteGuru
1000+ Posts Club


Joined: Jun 09, 2005
Posts: 2321

PostPost subject: Re: Last Picture Block - 2 rows
Posted: Tue Sep 18, 2007 4:53 pm
Reply with quote

Oh! OKKIE! Thanks! Big grin Embarassed Now I feel stupid. Wink Shocked
_________________
Lead Theme Designer - WebSiteGuru Designs

WebSiteGuru's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux 2.6.9 / Apache 2.2.6 / MySQL 5.0.27 / PHP 5 / DF Version 9.2.1
Back to top
View user's profile Visit poster's website Yahoo Messenger
NanoCaiordo
Developer


Joined: Jun 29, 2004
Posts: 3677
Location: Melbourne, AU

PostPost subject: Re: Last Picture Block - 2 rows
Posted: Tue Sep 18, 2007 4:56 pm
Reply with quote

My bad, instructions were not that clear, but at least we got it working Smile
_________________
.:: I met php the 03 December 2003 :: Unforgettable day! ::.

NanoCaiordo's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
MySQL 5.1 / PHP 5.3 / NextGen()
Back to top
View user's profile Visit poster's website
WebSiteGuru
1000+ Posts Club


Joined: Jun 09, 2005
Posts: 2321

PostPost subject: Re: Last Picture Block - 2 rows
Posted: Tue Sep 18, 2007 5:01 pm
Reply with quote

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
_________________
Lead Theme Designer - WebSiteGuru Designs

WebSiteGuru's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux 2.6.9 / Apache 2.2.6 / MySQL 5.0.27 / PHP 5 / DF Version 9.2.1
Back to top
View user's profile Visit poster's website Yahoo Messenger
WebSiteGuru
1000+ Posts Club


Joined: Jun 09, 2005
Posts: 2321

PostPost subject: Re: Last Picture Block - 2 rows
Posted: Wed Sep 19, 2007 4:48 am
Reply with quote

OK! It works now, with minor detail spacing. I'll try to figure that one out.
_________________
Lead Theme Designer - WebSiteGuru Designs

WebSiteGuru's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux 2.6.9 / Apache 2.2.6 / MySQL 5.0.27 / PHP 5 / DF Version 9.2.1
Back to top
View user's profile Visit poster's website Yahoo Messenger
WebSiteGuru
1000+ Posts Club


Joined: Jun 09, 2005
Posts: 2321

PostPost subject: Re: Last Picture Block - 2 rows
Posted: Wed Sep 19, 2007 2:28 pm
Reply with quote

All Done Thanks Nano. Very Happy Kudos for you. Wink
_________________
Lead Theme Designer - WebSiteGuru Designs

WebSiteGuru's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux 2.6.9 / Apache 2.2.6 / MySQL 5.0.27 / PHP 5 / DF Version 9.2.1
Back to top
View user's profile Visit poster's website Yahoo Messenger
3DdesktopsUK
Silver Supporter


Joined: Mar 22, 2005
Posts: 195
Location: Surrey - UK

PostPost subject: Re: Last Picture Block - 2 rows
Posted: Sat Apr 12, 2008 9:07 am
Reply with quote

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

_________________
Need a new 3D Desktop wallpaper? 3D Wallpapers UK - Original 3D Digital Wallpapers

3DdesktopsUK's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Windows 2003 Server / Apache / MySQL 5.0.41 / PHP Version 4.4.7 / CMS Version 9.1.2.1
Back to top
View user's profile Visit poster's website
rlgura
1000+ Posts Club


Joined: Mar 27, 2006
Posts: 1148
Location: Cleveland, OH USA

PostPost subject: Re: Last Picture Block - 2 rows
Posted: Sat Apr 12, 2008 4:43 pm
Reply with quote

$length is the total number of pictures - in your case it should be 6
_________________
Admin - Great Lakes Web Designs
Theme Designer - WebSite Guru Designs
Site Admin - Families with Food Allergies

rlgura's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux 2.6.27-grsec/Apache 2.2.11/MySQL 5.0.67-community-log/PHP 5.2.8/DF 9.2.1
Back to top
View user's profile Visit poster's website
3DdesktopsUK
Silver Supporter


Joined: Mar 22, 2005
Posts: 195
Location: Surrey - UK

PostPost subject: Re: Last Picture Block - 2 rows
Posted: Sat Apr 12, 2008 9:53 pm
Reply with quote

that's great!! o der me lol!!!

Thanks rlgura

_________________
Need a new 3D Desktop wallpaper? 3D Wallpapers UK - Original 3D Digital Wallpapers

3DdesktopsUK's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Windows 2003 Server / Apache / MySQL 5.0.41 / PHP Version 4.4.7 / CMS Version 9.1.2.1
Back to top
View user's profile Visit poster's website
3DdesktopsUK
Silver Supporter


Joined: Mar 22, 2005
Posts: 195
Location: Surrey - UK

PostPost subject: Re: Last Picture Block - 2 rows
Posted: Mon Jun 09, 2008 8:21 am
Reply with quote

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.

_________________
Need a new 3D Desktop wallpaper? 3D Wallpapers UK - Original 3D Digital Wallpapers

3DdesktopsUK's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Windows 2003 Server / Apache / MySQL 5.0.41 / PHP Version 4.4.7 / CMS Version 9.1.2.1
Back to top
View user's profile Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   Printer Friendly Page     Forum IndexCoppermine All times are GMT
Go to page 1, 2  Next
Page 1 of 2


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
You cannot attach files in this forum
You cannot download files in this forum

stopsoftwarepatents.eu petition banner
User Info [x]

Welcome Anonymous

Nickname
Password
(Register)

Last CVS commits [x]

Languages [x]

Community [x]

Support for DragonflyCMS in a other languages:

Deutsch
Español

X-links [x]
UltraEdit Browse Happy logo Firefox MySQL PostgreSQL Valid CSS! Valid XHTML 1.0! Unicode Encoded Badge NukeBiz Resources Raven DragonflyCMS Dedicated Now InsideSupport Lampe Berger

Preview theme [x]
Each user can view the site with a different theme.
Themes marked with a * also change the forum look.


You are seeing squares or questionmarks on this page?

All content of this website is copyrighted by the Creative Commons NC-SA
The logos and trademarks used on this site are the property of their respective owners
We are not responsible for comments posted by our users, as they are the property of the poster.
Our server runs on a P3 1.2GHz with 512MB RAM with no accelerators
Support GoPHP5.org
This page generated in 2.2677 seconds with 19 DB Queries in 0.2297 seconds
Memory Usage: 3.06 MB
Interactive software released under GNU GPL, Code Credits, Privacy Policy