Link to home
Start Free TrialLog in
Avatar of BrighteyesDesign
BrighteyesDesignFlag for Afghanistan

asked on

Add links to dynamic Jquery slider

I have a Jquery slider working fine with the attached code. The images load from the database and the first image has the required class of 'active'

What i'm trying to do now is add a link but when I try this code with the link...

</div>  <div class="holder">
<div id="slideshow">

 <?php $counter = 1; do { ?>
     <a href="<?php echo $row_homeImages['link']; ?>"><img src="upload/<?php echo $row_homeImages['imageUpload']; ?>" alt="Lilles Market1"  width="923" height="290" class="<?php if ($counter++ == 1) echo 'active'; ?>" /></a>
<?php } while ($row_homeImages = mysql_fetch_assoc($homeImages)); ?> </div>

  </div></div>

 ...the first image just shows over again. How should I be adding the link here?
</div>  <div class="holder">
<div id="slideshow"> 

 <?php $counter = 1; do { ?>
     <img src="upload/<?php echo $row_homeImages['imageUpload']; ?>" alt="Lilles Market1"  width="923" height="290" class="<?php if ($counter++ == 1) echo 'active'; ?>" />
    <?php } while ($row_homeImages = mysql_fetch_assoc($homeImages)); ?> </div>

  </div></div>

Open in new window

Avatar of Lukasz Chmielewski
Lukasz Chmielewski
Flag of Poland image

Why not like this:

</div>  <div class="holder">
<div id="slideshow"> 

<?php 
   $counter = 1; 
   while ($row_homeImages = mysql_fetch_assoc($homeImages)){
?>
     <img src="upload/<?php echo $row_homeImages['imageUpload']; ?>" alt="Lilles Market1"  width="923" height="290" class="<?php if ($counter++ == 1) echo 'active'; ?>" />

    <?php $counter++; }  ?> </div>

  </div></div>

Open in new window

Sorry, missed the if part:

</div>  <div class="holder">
<div id="slideshow"> 

<?php 
   $counter = 1; 
   while ($row_homeImages = mysql_fetch_assoc($homeImages)){
?>
     <img src="upload/<?php echo $row_homeImages['imageUpload']; ?>" alt="Lilles Market1"  width="923" height="290" class="<?php if ($counter == 1) echo 'active'; ?>" />

    <?php $counter++; }  ?> </div>

  </div></div>

Open in new window

Avatar of BrighteyesDesign

ASKER

Thanks for that,

That works in the same way as the original code. I can't seem to incorporate a link from the image.

Your code with an image link added gives you this...

http://www.travelstareuropean.com/NEW/indextest.php

Just the first image repeats



But without the link (code below) it's fine...

http://www.travelstareuropean.com/NEW/index.php



<?php 
   $counter = 1; 
   while ($row_homeImages = mysql_fetch_assoc($homeImages)){
?>
     <img src="upload/<?php echo $row_homeImages['imageUpload']; ?>" alt="Lilles Market1"  width="923" height="290" class="<?php if ($counter == 1) echo 'active'; ?>" />

    <?php $counter++; }  ?>

Open in new window

<?php 
   $counter = 1; 
   while ($row_homeImages = mysql_fetch_assoc($homeImages)){
?>
     <a href="test.html"><img src="upload/<?php echo $row_homeImages['imageUpload']; ?>" alt="Lilles Market1"  width="923" height="290" class="<?php if ($counter == 1) echo 'active'; ?>" /></a>

    <?php $counter++; }  ?>

Open in new window

So just to recap, I need all the images to display and have links
ASKER CERTIFIED SOLUTION
Avatar of Lukasz Chmielewski
Lukasz Chmielewski
Flag of Poland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
It was how Jquery treats links. Rather than persevere with this code I simply used another Jquery slider that supported links.

Just really of thought of that sooner!

Cheers for your help though.