That can be a great picture (flash) mode, needs improvement

Started by Neverhurry, April 04, 2009, 03:43:06 AM

Previous topic - Next topic

Neverhurry

When I used molyx board i loved this mod, or function. It can show the latest pictures from your forum attachment pictures (you can set numbers, e.g, 3, 5, or any number) in a flash way, very beautiful and i should emphasize, very USEFUL.

But i don't know smf well enough, i am very new to it. I attach the flash_pic.php here, you can see, that in molyx, they use the term "forum" instead of "board", etc, e.g. http://www.cinask.com/index.php?forumid=5 in molyx board become http://www.cinask.com/index.php?board=50.0. And many other differents. If you know smf database better, maybe together we can improve this to fit smf.

<?php
#**************************************************************************#
#   notice:
#   If there is no parameters setting then to call latest pictures from #   whole forum
#   If you want to show only pics from a certain board, say board 5,
#   then use <script src="flash_pic.php?f=5" type="text/javascript">
#  </script>
#**************************************************************************#
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'FLASH_PIC');

require_once(
'./global.php');

class
flash_pic
{
function show()
{
  global
$forums, $_INPUT,$DB;
  if(
$_INPUT['f']){
  $forumid=floor($_INPUT['f']);
  $where='and t.forumid='.$forumid;
  }
 
$sql_str="select t.tid,t.title,a.location,a.attachpath from  ".TABLE_PREFIX."thread t right join ".TABLE_PREFIX."post p ON(p.threadid=t.tid)  right join ".TABLE_PREFIX."attachment a ON(p.pid=a.postid)  where t.attach!=0 $where  group by t.tid order by t.tid desc limit 0,5 ";
 
$picdata = $DB->query($sql_str);
  if (
$DB->num_rows($picdata)) {
  $files='';
while ( $a = $DB->fetch_array($picdata) ) {
if($files){$files.='|';}
if($links){$links.='|';}
if($texts){$texts.='|';}
$files.=$forums->cache['settings']['uploadurl'].'/'.$a['attachpath'].'/'.$a['location'];
$links.='showthread.php?t='.$a['tid'];
$a['title']=strip_tags($a['title']);
$a['title']=str_replace("'","",$a['title']);
$a['title']=str_replace("|","",$a['title']);
$texts.=$a['title'];
}
$html=<<<EOD
//set width and height of the flash show
var swf_width=260
var swf_height=198
var config='5|0xffffff|0x0099ff|50|0xffffff|0x0099ff|0x000000'
// config: automatic show time (second)|font color|font background color|opacity of the font background|clickable number color|current clickable button color|general clickable button color
var files='
{$files}'
var links='
{$links}'
var texts='
{$texts}'
document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+ swf_width +'" height="'+ swf_height +'">');
document.write('<param name="movie" value="images/focus.swf" />');
document.write('<param name="quality" value="high" />');
document.write('<param name="menu" value="false" />');
document.write('<param name=wmode value="opaque" />');
document.write('<param name="FlashVars" value="config='+config+'&bcastr_flie='+files+'&bcastr_link='+links+'&bcastr_title='+texts+'" />');
document.write('<embed src="images/focus.swf" wmode="opaque" FlashVars="config='+config+'&bcastr_flie='+files+'&bcastr_link='+links+'&bcastr_title='+texts+'& menu="false" quality="high" width="'+ swf_width +'" height="'+ swf_height +'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
document.write('</object>');
EOD;
echo
$html;
}

}
}

$output = new flash_pic();
$output->show();

?>
I am using SMF 2.0.1, curve themes.

tyty1234

Well, I'm not much of a "hardcore" programmer, but I think this function/mod was written for PHP 5, but it needs to be for at least 4.1.0 as that is part of the system requirements for SMF.
My Activity: Inactive
My Links: tyty1234's SMF Site | SMF Package Parser | SMF Helper | My Mods [5]
Subscribe to my SMF blog for updates
PMs for support will not be accepted, unless requested otherwise.

Neverhurry

Quote from: tyty1234 on April 04, 2009, 03:53:29 AM
Well, I'm not much of a "hardcore" programmer, but I think this function/mod was written for at least PHP 4.1.0 as that is part of the system requirements for SMF.

you mean the code above is too old?
I am using SMF 2.0.1, curve themes.

tyty1234

It's not old, it's just that the code looks like it was coded for PHP 5 since for the fact you have classes and vars there.

EDIT: just realized my previous post was worded wrong. xD
My Activity: Inactive
My Links: tyty1234's SMF Site | SMF Package Parser | SMF Helper | My Mods [5]
Subscribe to my SMF blog for updates
PMs for support will not be accepted, unless requested otherwise.

Neverhurry

Ok, but what do you think is it difficult to make it fit smf's php4?
I am using SMF 2.0.1, curve themes.

tyty1234

Well, I haven't used any functions that are associated with PHP 5, so I'm not sure how hard it will be to make it so that it is PHP 4...
My Activity: Inactive
My Links: tyty1234's SMF Site | SMF Package Parser | SMF Helper | My Mods [5]
Subscribe to my SMF blog for updates
PMs for support will not be accepted, unless requested otherwise.

Rumbaar

I'll move this to the Mod Request section of the forum, as it's not really general SMF support.
"An important reward for a job well done is a personal sense of worthwhile achievement."

[ Themes ]

Advertisement: