Support ⇒ Modules & Blocks ⇒ Customized latest downloads block not working ⇒ Community Forums ⇒ CPG Dragonfly™ CMS
Forum IndexModules & Blocks

Customized latest downloads block not working Reply to topic


Hi, i have a customized block for latest downloads with screen shots.
The block works fine until i add a marquee, once i add the marquee i can't add/move any blocks below it or they disappear. Can anyone see anything wrong with the code?

if (!defined('CPG_NUKE')) { exit; } global $db, $prefix; $dl_mod = 'MapDB'; $dl_mod_prefix = $prefix.'_'.strtolower($dl_mod); require_once('modules/'.$dl_mod.'/functions/linking.inc'); $content = ''; if (!is_active($dl_mod)) { $content = 'ERROR'; return trigger_error($dl_mod.' module is inactive', E_USER_WARNING); } $a = 1; $result = $db->sql_query("SELECT d.lid, d.title, SUM(s.hits) AS hits, ss.url AS img_url, d.desc_short FROM ".$dl_mod_prefix."_mapdb d LEFT JOIN ".$dl_mod_prefix."_stats s ON (s.id = d.lid) LEFT JOIN ".$dl_mod_prefix."_screenshots ss ON (ss.id = d.screen) WHERE d.active=1 GROUP BY s.id ORDER BY hits DESC LIMIT 0,10"); if ($db->sql_numrows($result) < 1) { $content = 'ERROR'; return trigger_error('There are no maps in '.$dl_mod, E_USER_WARNING); } $content .= '<marquee align="center" direction="up" scrollamount="2" scrolldelay="70" onmouseover=\'this.stop()\' onmouseout=\'this.start()\'><br />'; while (list($lid, $dtitle, $hits, $ss, $desc) = $db->sql_fetchrow($result)) { if ($ss) { if (ereg('://', $ss)) { $ss .= '" width="100'; } else { $ss = dl_thumbimage($ss).'" width="100';} } else { $ss = dl_image('mapdb.png').'" width="100'; } $content .= '<table><tr><td>'; $content .= '<td>'.$a.': <a href="'.getlink($dl_mod.'&amp;file=details&amp;id='.$lid).'">'.$dtitle.'</a><br /><br />'; $content .= '<img src="'.$ss.'" border="0" alt="" /><br><hr /></td>'; $content .= '</tr></marquee></table>'; $a++; } $db->sql_freeresult($result);

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Litespeed/Apache2.4.23/MySQL5.5.42/PHP 5.6.25/DF 9.4.0.0


$content .= '</tr></marquee></table>';

you're closing the <marquee> in the wrong place.
it has to closed AFTER the <table>:

$content .= '</tr></marquee></table>';


and i just found a bug in this site, the marquee tag isnt being filtered properly in the preview view of the post if it is inside a QUOTE tag

www.greenday2k.net

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):

Last edited by greenday2k on Mon Jan 18, 2016 2:33 am; edited 1 time in total


greenday2k wrote

and i just found a bug in this site, the marquee tag isnt being filtered properly in the preview view of the post if it is inside a QUOTE tag


Sry not sure what you mean isnt being filtered properly? Take the quotes out?

$content .= '</tr></table></marquee>';
If i change the code to as above the first item scrolls but the others 2-10 are fixed, showing and not scrolling

P.S. Thanks for input.
Attachment: block.png
Description
Filesize 23.55 KiB
Viewed 0 Time(s)
You are not allowed to view/download this attachment

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Litespeed/Apache2.4.23/MySQL5.5.42/PHP 5.6.25/DF 9.4.0.0

Last edited by BobCat on Mon Jan 18, 2016 2:46 am; edited 1 time in total


try this
<?php
if (!defined('CPG_NUKE')) { exit; }

global $db, $prefix;

$dl_mod = 'MapDB';
$dl_mod_prefix = $prefix.'_'.strtolower($dl_mod);
require_once('modules/'.$dl_mod.'/functions/linking.inc');
$content = '';
if (!is_active($dl_mod)) {
    $content = 'ERROR';
    return trigger_error($dl_mod.' module is inactive', E_USER_WARNING);
}
$a = 1;
$result = $db->sql_query("SELECT d.lid, d.title, SUM(s.hits) AS hits, ss.url AS img_url, d.desc_short FROM ".$dl_mod_prefix."_mapdb d
LEFT JOIN ".$dl_mod_prefix."_stats s ON (s.id = d.lid) 
LEFT JOIN ".$dl_mod_prefix."_screenshots ss ON (ss.id = d.screen)
WHERE d.active=1 GROUP BY s.id ORDER BY hits DESC LIMIT 0,10");
if ($db->sql_numrows($result) < 1) {
    $content = 'ERROR';
    return trigger_error('There are no maps in '.$dl_mod, E_USER_WARNING);
}
$content .= '<marquee align="center" direction="up" scrollamount="2" scrolldelay="70" onmouseover=\'this.stop()\' onmouseout=\'this.start()\'><br />';
while (list($lid, $dtitle, $hits, $ss, $desc) = $db->sql_fetchrow($result)) {
	if ($ss) {
		if (!strpos($ss, '://')) {
			$ss = dl_thumbimage($ss);
		}
	} else {
		$ss = dl_image('mapdb.png');
	}
    $content .= $a.': <a href="'.getlink($dl_mod.'&amp;file=details&amp;id='.$lid).'">'.$dtitle.'</a><br /><br />';
    $content .= '<img src="'.$ss.'" width="100" border="0" alt="" /><hr/>';
    $a++;
}
$content .= '</marquee>';
$db->sql_freeresult($result);

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Fedora 25 / Apache 2.4.27 / MariaDB 10.1.26 / PHP 7.1.10 / Mercurial

Last edited by DJ Maze on Mon Jan 18, 2016 9:47 am; edited 1 time in total


Thanks DJ Maze but it made it worse
The block content span across the page now, see pic
Attachment: block2.png
Description
Filesize 46.45 KiB
Viewed 1 Time(s)
You are not allowed to view/download this attachment

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Litespeed/Apache2.4.23/MySQL5.5.42/PHP 5.6.25/DF 9.4.0.0


Correct, i forgot to remove a <td>.
Changed it, should be better now.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Fedora 25 / Apache 2.4.27 / MariaDB 10.1.26 / PHP 7.1.10 / Mercurial


THANK YOU!

2 last questions if i may.

First, the images sit to the left not center, how do i fix this?

Second (if possible) to make it so thumb nails are clickable links like the Random Picture Block

thanks again.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Litespeed/Apache2.4.23/MySQL5.5.42/PHP 5.6.25/DF 9.4.0.0


BobCat wrote
First, the images sit to the left not center, how do i fix this?

style="text-align:center"

BobCat wrote
Second (if possible) to make it so thumb nails are click-able links like the Random Picture Block

Yes, put the </a> behind the <img> tag

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Fedora 25 / Apache 2.4.27 / MariaDB 10.1.26 / PHP 7.1.10 / Mercurial

Last edited by DJ Maze on Mon Jan 18, 2016 1:50 pm; edited 2 times in total


Thanks again for the help Very Happy

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Litespeed/Apache2.4.23/MySQL5.5.42/PHP 5.6.25/DF 9.4.0.0


I found another bug with this when viewing via IE
The writing spans outside the block in IE but is fine using FireFox

Any ideas how to fix this one?

Thanks.
Attachment: block.png
Description
Filesize 14.27 KiB
Viewed 1 Time(s)
You are not allowed to view/download this attachment

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Litespeed/Apache2.4.23/MySQL5.5.42/PHP 5.6.25/DF 9.4.0.0


Problem is that the text "Outpost_....." can't be broken into parts.
Something like the following in css/style should work
max-width: 100%; overflow: auto;

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Fedora 25 / Apache 2.4.27 / MariaDB 10.1.26 / PHP 7.1.10 / Mercurial


Browser specific CSS rules, in this case IE, could be placed inside theme's style sheet ie.css.

Marco

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

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
CloudLinux / Apache 2.4 LSAPI / MySQLi 5.6 / PHP 5.6 / DCVS

All times are UTC


Jump to: