【发布时间】:2017-08-11 14:27:40
【问题描述】:
我的主页上有没有链接到任何地方的滑块横幅。我需要什么代码为每张图片添加链接?下面的代码可以吗?:
Thank you! I need to add a different link to each banner. The banners are all going to the printf('<a href="yourlink.html"> link. What am I doing wrong? <div id="home">
<div class="banner">
<div class="banner-slider">
<?php
if (!empty($options['slider_photo'])):
$slider_photos = explode(',', $options['slider_photo']);
foreach ($slider_photos as $k => $img):
printf('<a href="http://www.nemotile.com/tile/product/Handwritten/"><div class="banner-%d" style="background-image:url(%s)"></div></a>', $k, $img);
endforeach;
else: ?>
<a href="http://www.nemotile.com/tile/product/Handwritten/"><div class="banner-1"></div></a>
<a href="http://www.nemotile.com/tile/product/patchwork/"><div class="banner-2"></div>
<a href="http://www.nemotile.com/tile/product/BisazzaCementTiles/"><div class="banner-3"></div>
<div class="banner-5"></div>
<?php endif; ?>
</div>
【问题讨论】: