我在我的网站上使用了floom mootools滑块。它是动态显示图像,但分配给图像的超链接不起作用!
javascript代码为:
<script type="text/javascript" src="{$smarty.const.WEB_PATH}js/floom.js"></script> {literal}
<script type="text/javascript">
window.addEvent('domready', function(e) {
var slides = $$('#blinds img');
}
$('blinds').floom(slides, {
slidesBase: '',
sliceFxIn: {
top: 00
}
});
});
</script>
我的PHP代码,在.tpl文件中写入显示5个随机图像是:
<div class="sideshow" style="overflow: hidden;">
{php}
// integer starts at 0 before counting
$i = 0;
$dir = './wallpapers/';
if ($handle = opendir($dir)) {
while (($file = readdir($handle)) !== false){
if (!in_array($file, array('.', '..')) && !is_dir($dir.$file))
$totalfiles++;
}
}
// prints out how many were in the directory
#echo "There were $totalfiles files";
$subcount=0;
foreach(glob('./wallpapers/*.*') as $filename)
{
$readonlyfile = substr($filename, 13);
#echo $readonlyfile;
#echo "<br>";
$lastchars=substr($readonlyfile, -12);
$checkstring="-730x251.jpg";
if($lastchars==$checkstring)
{
$subcount=$subcount+1;
$filenameonly=substr($filename, 13);
$finalfilealone=substr($filenameonly, 0, -12);
$imgarr[$subcount]=$finalfilealone;
}
}
{/php}
{php}
echo "<div id='blinds'>";
for($j=0;$j<1;$j++)
{
$generaterandomseq=rand(1,$subcount);
$gennum=intval($generaterandomseq);
$cntarray[$j]=$gennum;
$presentval=$cntarray[$j];
$makeimglink="http://4kwallpapers.in/wallpapers/".$imgarr[$presentval]."-730x251.jpg";
$makenavlink="http://4kwallpapers.in/".$imgarr[$presentval]."-wallpapers.html";
echo "<a href='$makenavlink'><img src='$makeimglink' /></a>";
echo "<a href=$makenavlink><img src=$makeimglink /></a>";
}
for($j=0;$j<1;$j++)
{
$generaterandomseq=rand(1,$subcount);
$gennum=intval($generaterandomseq);
$cntarray[$j]=$gennum;
$presentval=$cntarray[$j];
$makeimglink="http://4kwallpapers.in/wallpapers/".$imgarr[$presentval]."-730x251.jpg";
$makenavlink="http://4kwallpapers.in/".$imgarr[$presentval]."-wallpapers.html";
echo "<a href='$makenavlink'><img src='$makeimglink' /></a>";
}
for($j=0;$j<1;$j++)
{
$generaterandomseq=rand(1,$subcount);
$gennum=intval($generaterandomseq);
$cntarray[$j]=$gennum;
$presentval=$cntarray[$j];
$makeimglink="http://4kwallpapers.in/wallpapers/".$imgarr[$presentval]."-730x251.jpg";
$makenavlink="http://4kwallpapers.in/".$imgarr[$presentval]."-wallpapers.html";
echo "<a href='$makenavlink'><img src='$makeimglink' /></a>";
}
for($j=0;$j<1;$j++)
{
$generaterandomseq=rand(1,$subcount);
$gennum=intval($generaterandomseq);
$cntarray[$j]=$gennum;
$presentval=$cntarray[$j];
$makeimglink="http://4kwallpapers.in/wallpapers/".$imgarr[$presentval]."-730x251.jpg";
$makenavlink="http://4kwallpapers.in/".$imgarr[$presentval]."-wallpapers.html";
echo "<a href='$makenavlink'><img src='$makeimglink' /></a>";
}
for($j=0;$j<1;$j++)
{
$generaterandomseq=rand(1,$subcount);
$gennum=intval($generaterandomseq);
$cntarray[$j]=$gennum;
$presentval=$cntarray[$j];
$makeimglink="http://4kwallpapers.in/wallpapers/".$imgarr[$presentval]."-730x251.jpg";
$makenavlink="http://4kwallpapers.in/".$imgarr[$presentval]."-wallpapers.html";
echo "<a href='$makenavlink'><img src='$makeimglink' /></a>";
}
echo "</div>";
{/php}
</div>
上面的程序,首先修剪文件(壁纸)的内容,向左和向右,以获得确切的壁纸名称。
您可以在http://www.4kwallpapers.in上看到现场演示 主页显示幻灯片,使用上述编码。 它可以正确显示图像。但是,链接不起作用。请帮我解决这个问题。感谢您的期待。