|
以 "改造mod_latestnews的输出样式之一" 为基础, 这次将他改造成 滚动图片, 思路很简单, 图片有了, 我们可以利用marquee标签可以很容易的让他滚动起来. 基础结构为: <marquee behavior="scroll" direction="up" height="120" width="150" >
<img src="..."><img src="...">
</marquee> 当然,这个是有点缺陷,就是滚动的时候会间断, 所以我用到了SCRIPT 来处理他,把图片罗列两次,在视觉上就不会有间断的情形了. 在xml文件的在</params>的上一行加上定义滚动图片的框架的宽和高: <param name="divwidth" type="text" default="150px" label="容器宽度" />
<param name="divheight" type="text" default="120px" label="容器高度" /> 在php文件的$imagewidth = intval($params->get('imagewidth', 0)) ;下面增加: $divwidth = trim( $params->get( 'divwidth' ) );
$divheight = trim( $params->get( 'divheight' ) ); 取得定义的值. 将原 <div 标签 及属性内容替换为: <div id=demo style="overflow: hidden; width: <?php echo $divwidth; ?>;
height: <?php echo $divheight; ?>;" align="center" class="<?php echo $moduleclass_sfx; ?>">
<table cellPadding="0" align="center" border="0" cellspace="0"><tbody><tr>
<td id="demo1" vAlign="top" height="150"> 将 $image = explode("|", $row->images) ; 下面的 echo 里的<br> 和标题 '. $row->title' 去掉,因为是单纯的滚动图片了.当然这个标题可以放在 图片的 alt 属性值里. 接着我们在 ?> 下面增加: </td><td id=demo2 vAlign="top" height="<?php echo $divheight; ?>"></td></tr></tbody></table></div>
<SCRIPT>
var speed=20
demo2.innerHTML=demo1.innerHTML
function Marquee1(){
if(demo2.offsetWidth-demo.scrollLeft<=0)
demo.scrollLeft-=demo1.offsetWidth
else{
demo.scrollLeft++
}
}
var MyMar1=setInterval(Marquee1,speed)
demo.onmouseover=function() {clearInterval(MyMar1)}
demo.onmouseout=function() {MyMar1=setInterval(Marquee1,speed)}
</SCRIPT>这样就完成了. 如果你既需要这个也需要mod_latestnews,那就在改名吧, 我改成了mod_latestnewspicscroller ;方法同 该造之一. 打包就可以安装使用了. 你也可以下载我做好的. 如果你是 mambo 用户,而想使用这个的话,需要修改 php文件的两个地方[以我制作的文件为基础] 在14行前增加 // 改变为: //ullDate = $database->getNullDate(); 将21,22行中的 $nullDate 更改为: 0000-00-00 00:00:00 就可以了.
Permanent URL: http://www.autoit.cn/index.php/content/view/52/25.html
| 8 | 阿廖 @ 2007-06-19 10:41:47 : | | 那你帮我贴到论坛吧,我刚注册,还不可以发贴啊呀 |
| 7 | Autoit @ 2007-06-19 09:52:43 : to 阿廖 | | 这样的问题,到论坛讨论比较好。 |
| 6 | 阿廖 @ 2007-06-19 08:49:42 : | xml的代码 RSGallery2 Thumbnail Scroller 25th of march 2007 Daniel Tulp This module is released under the GNU/ GPL license mail@danieltulp.nl http://design.danieltulp.nl 1.07 Scrolls selected thumbnails from the RSGallery2 component for Joomla!. Note: this module uses the proprietary tag marquee, therefore not valid. mod_rsg2scroller.php No Yes No Yes Up Down Left Right No Yes Gallery Display No Yes Px % Px % Random Date Hits Votes Rating No Yes
|
| 5 | 阿廖 @ 2007-06-19 08:49:17 : | 版主,你做的那个效果真的很好啊,我现在用的是RSGallery2图库,用RSGallery2 Thumbnail Scroller实现对图库内的图片进行滚动,是从右向左滚动,但是滚动时,在图片还未出来时,会显示是空白的,不能像你做的那个电力公司的网站一样,我希望能做到一打开网站就可以为示图片然后才滚动,我将RSGallery2 Thumbnail Scroller的PHP代码贴出来,你帮我看看要怎么改啊,还是说有更好的模块可以实现,我只要求用图片中提出图片就行了,不必从文章中提取. setQuery( $query ); $RSG2Itemidobj = $database->loadObjectList(); if (count($RSG2Itemidobj) > 0) $RSG2Itemid = $RSG2Itemidobj[0]->id; //initialise init file global $mosConfig_absolute_path; require_once($mosConfig_absolute_path.'/administrator/components/com_rsgallery2/init.rsgallery2.php'); // Retrieve the parameters. $Clickornot = $params->get( 'Clickornot', '1'); $link2gal = trim ( $params->get( 'link2gal', 'dis')); $Pause = $params->get( 'Pause', '1'); $useACL = $params->get( 'useACL', '0'); $usegalselect = $params->get( 'usegalselect', '0'); $galselect = $params->get( 'galselect'); $Width = intval ( $params->get( 'Width', '80')); $WidthUnit = trim ( $params->get( 'widthunit', '%')); $Height = intval ( $params->get( 'Height', '150')); $HeightUnit = trim ( $params->get( 'heightunit', 'px')); $PicsNum = intval ( $params->get( 'PicsNum', '5')); $PickMethod = trim ( $params->get( 'PickMethod', 'Rand()')); $ScrollDirection= trim ( $params->get( 'ScrollDirection','up')); $ScrollAmount = intval ( $params->get( 'ScrollAmount', '2')); $ScrollDelay = intval ( $params->get( 'ScrollDelay', '50')); $ScrollSpace = intval ( $params->get( 'ScrollSpace', '2')); $BugSpace = intval ( $params->get( 'BugSpace', '10')); $usecss = $params->get( 'usecss', '1'); $css = $params->get( 'css'); //determine which gallery id's to use //use ACL if($useACL){ global $rsgAccess; //check if acl is activated if(rsgAccess::aclActivated()){ //make list of allowed gallery_ids $gal_ids = $rsgAccess->actionPermitted('view'); if($usegalselect){ if(in_array($galselect, $gal_ids)){ $list = "WHERE #__rsgallery2_files.gallery_id IN(".$galselect." "; } else{ echo "One or more gallery id limits is not viewable for the current usertype"; exit; } } else{ $list = "WHERE #__rsgallery2_files.gallery_id IN(".implode(",", $gal_ids)." "; } } else{ echo"ACL not enabled in RSGallery2 configEnable it, or also disable it for this module"; exit; } } else{ //determine gallery id's to use if only usegalsselect if($usegalselect){ $list = "WHERE gallery_id IN(".$galselect." "; } else{ $list = ''; } } // Retrieve the selected images from the database. $query = "SELECT * FROM #__rsgallery2_files $list ORDER BY $PickMethod DESC LIMIT $PicsNum"; $database->setQuery ($query); $rows = $database->LoadObjectList (); //error trapping: if(mysql_error()){ echo "MySQL error ".mysql_errno().": ".mysql_error()."\nWhen executing:\n$query\n"; } //css, the javascript that can insert it into the head, does not work properly in ie if($usecss){ echo "".$css.""; } // Set the marquee parameters. echo " ";?> name; $limitstart = $row->ordering - 1; // Insert an tag if the images are clickable. if ($Clickornot) { //display or gallery view if($link2gal == 'dis'){ ?> " href="id.'&catid='.$row->gallery_id.'&limitstart='.$limitstart);?>"> " href="id.'&catid='.$row->gallery_id);?>"> "; // Insert a tag if the images are clickable. if ($Clickornot){echo "";} }?>
|
| 4 | Autoit @ 2007-04-26 11:04:09 : | 滚是可以滚的. 只是模板里不要有 Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 这个申明 |
| 3 | 访客 @ 2007-04-20 09:02:32 : | Autoit 老大,我发现这个模块在Firefox下面图片不会滚动,只会静止的显示一个图片。 另,好像设置了图片宽度这个值之后,就没有任何图片显示了,请问,是不是根据图片宽度对文章里提取的图做了筛选? |
| 2 | ourac @ 2007-03-29 17:12:07 : 好像都不动的..这是为什么 | 好像都不动的..这是为什么 是不是js的问题啊? |
| 1 | crag @ 2006-10-14 00:15:54 : 大大 | 这个滚动图片模块,在图片比例不同时,生成的图片大小不一致,希望能改进下  |
Only registered users can write comments. Please login or register. |