adding a links to my banner images in a banner rotator code

1.4k views Asked by At

I've searched but the results I found weren't useful to my case.

I have this code that shows rotating banners on my page. It pulls images from a folder and I can add more images through admin. I would like to make those images clickable, so they can take you to a page on my site. I don't know PHP, but I can copy paste well and do have some logic. I would appreciate if you could modify the existing code, so that it works.

Thank you

<div class="baner">
            <div class="baner_icon">
            </div>
            <div id="rotator">
                <ul>
                    <?php 
                    $baners = TopBaners::model()->recently()->findAll();
                    $i = 0;
                      foreach ($baners as $value) {
                        if ($i == 0) {
                            ?><li class="show"><img src="/i/<?php echo $value->file ?>" width="999" height="300px" alt="IMG"></li><?PHP
                        } else {
                            ?><li><img src="/i/<?php echo $value->file ?>" height="300px" width="999" alt="IMG"></li><?PHP
                        }
                        $i++;
                      }
                ?>
                </ul>
            </div>
        </div>
1

There are 1 answers

4
AudioBubble On
        <div class="baner">
        <div class="baner_icon">
        </div>
        <div id="rotator">
            <ul>
                <?php 
                $baners = TopBaners::model()->recently()->findAll();
                $i = 0;
                  foreach ($baners as $value) {
                    if ($i == 0) {
                        ?><a href = "YOUR LINK"><li class="show"><img src="/i/<?php echo $value->file ?>" width="999" height="300px" alt="IMG"></li></a><?PHP
                    } else {
                        ?><a href = "YOUR LINK"><li><img src="/i/<?php echo $value->file ?>" height="300px" width="999" alt="IMG"></li></a><?PHP
                    }
                    $i++;
                  }
            ?>
            </ul>
        </div>
    </div>