Home Private Messages Search
CPG Dragonfly™ CMS stopsoftwarepatents.eu petition banner
Toggle Content
 
Forums ⇒ DragonflyCMS ⇒ Coppermine ⇒ Last Picture Block - 2 rows


Last Picture Block - 2 rows
Please post bugs in the Projects Module.
Post anything and everything else about Coppermine in this forum.

Go to page Previous  1, 2
Post new topic    Reply to topic    Printer Friendly Page     Forum Index ⇒  Add-Ons & BlocksCoppermine

View previous topic :: View next topic  
Author Message
WebSiteGuru
1000+ Posts Club
1000+ Posts Club

Offline Offline
Joined: Jun 09, 2005
Posts: 2318

PostPosted: Mon Jun 09, 2008 2:56 pm
Post subject: Re: Last Picture Block - 2 rows

See if that's work. I'm not at my computer so I can't test it.

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=4;
$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>';

_________________
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
rlgura
1000+ Posts Club
1000+ Posts Club

Offline Offline
Joined: Mar 27, 2006
Posts: 1146
Location: Cleveland, OH USA
PostPosted: Mon Jun 09, 2008 4:46 pm
Post subject: Re: Last Picture Block - 2 rows

Nope: problem is here:

Code::
if ($length/$rows == $pic)
This will be true only once, no matter how many rows.
change to
Code::
if ($pic/$length/$rows == floor($pic/$length/$rows))

_________________
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
Silver Supporter

Offline Offline
Joined: Mar 22, 2005
Posts: 195
Location: Surrey - UK
PostPosted: Mon Jun 09, 2008 6:07 pm
Post subject: Re: Last Picture Block - 2 rows

sorry guys, still no joy Sad I have pasted guru's code (changed $length=12) into a new block and replaced the code rlgura mentions to ensure I hadn't left any old bits in there.

Now 12 displaying in 1 row

xxxxxxxxxxxx

Any ideas? and cheers alot.

_________________
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
1000+ Posts Club

Offline Offline
Joined: Mar 27, 2006
Posts: 1146
Location: Cleveland, OH USA
PostPosted: Mon Jun 09, 2008 7:59 pm
Post subject: Re: Last Picture Block - 2 rows

Hmmm - guess I need a couple parens in there... Here's the complete code, tested this time:

Code::
<?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=12;
$rows=4;
$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 ($pic/($length/$rows) == floor($pic/($length/$rows))) $content .= '</tr><tr>';
}
$content .= '</tr><tr><tr align="center"></td></tr></table>';

_________________
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
WebSiteGuru
1000+ Posts Club
1000+ Posts Club

Offline Offline
Joined: Jun 09, 2005
Posts: 2318

PostPosted: Mon Jun 09, 2008 8:18 pm
Post subject: Re: Last Picture Block - 2 rows

Oops Embarassed missed read the first time. Follow rlgura last codes, It should work now.

_________________
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
Silver Supporter

Offline Offline
Joined: Mar 22, 2005
Posts: 195
Location: Surrey - UK
PostPosted: Mon Jun 09, 2008 10:17 pm
Post subject: Re: Last Picture Block - 2 rows

Cheers guys, works like a charm!! Jus one other thing while we'll on topic, if I wanted to specify an album, which part could I change to point to something like

"coppermine/thumbnails/album=190.html"

thanks again for all your help ***** service!!

_________________
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
1000+ Posts Club

Offline Offline
Joined: Mar 27, 2006
Posts: 1146
Location: Cleveland, OH USA
PostPosted: Tue Jun 10, 2008 4:52 pm
Post subject: Re: Last Picture Block - 2 rows

Off the top of my head, something like this:

PHP:
$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 and a.aid=190 GROUP BY pid ORDER BY pid DESC LIMIT $length");

_________________
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
Display posts from previous:   
Post new topic    Reply to topic    Printer Friendly Page    Forum Index ⇒  Add-Ons & BlocksCoppermine
Page 2 of 2
All times are GMT
Go to page Previous  1, 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


 
   Toggle Content User Info

Welcome Anonymous

Nickname
Password
(Register)

   Toggle Content Last CVS commits
· Fixed .ico Expires header.
· Removed domain name from cookies so subdomains wont access them anymore.
· CSS and JS, case insensitives.
· CSS and JS, send correct HTTP 1.1 headers and fixed issues where themes and...
· Further security class improvements.
· 301 redirects on LEO changes
· Option to force 3xx http status codes
· Validate googlebot.com and google.com crawlers.
· CCBot
· Rss with etag and atom.

Aiheesta Lisää...

   Toggle Content Community

Support for DragonflyCMS in a other languages:

Deutsch
Español

   Toggle Content X-links
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

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
Interactive software released under GNU GPL, Code Credits, Privacy Policy