News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

help with clickable image

Started by Canadian_user, May 26, 2015, 01:05:27 AM

Previous topic - Next topic

Canadian_user

Hi Everyone, i need help creating multiple clickable images in a single html code.  So for example, when image_1 is clicked, its redirected to hxxp:toronto.test001.com [nonactive] etc.



image source =   hxxp:test001.com/image_1.png [nonactive]     destination = hxxp:toronto.test001.com [nonactive]
image source =   hxxp:test001.com/image_2.png [nonactive]     destination = hxxp:chicago.test001.com [nonactive]
image source =   hxxp:test001.com/image_3.png [nonactive]     destination = hxxp:calgary.test001.com [nonactive]
image source =   hxxp:test001.com/image_4.png [nonactive]     destination = hxxp:indiana.test001.com [nonactive]

Thanks for your help.

CHeers!

margarett

You should probably build an array of combinations, then loop through it and do whatever you want to do with it. Eg: create a link with the image :)
<?php

$links 
= array(
'1' => array(
'image' => 'http://test001.com/image_1.png',
'link' => 'http://toronto.test001.com',
),
'2' => array(
'image' => 'http://test001.com/image_2.png',
'link' => 'http://chicago.test001.com',
),
'3' => array(
'image' => 'http://test001.com/image_3.png',
'link' => 'http://calgary.test001.com',
),
'4' => array(
'image' => 'http://test001.com/image_4.png',
'link' => 'http://indiana.test001.com',
),
);
foreach (
$links as $key => $value)
{
echo '<a href="'$value['link'], '"><img src="'$value['image'], '"></a><br>';
}




?>
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

JBlaze

<?php
$links 
= array(
      array(
          
'image' => 'http://test001.com/image_1.png',
          
'link' => 'http://toronto.test001.com',
      ),
      array(
          
'image' => 'http://test001.com/image_2.png',
          
'link' => 'http://chicago.test001.com',
      ),
      array(
          
'image' => 'http://test001.com/image_3.png',
          
'link' => 'http://calgary.test001.com',
      ),
      array(
          
'image' => 'http://test001.com/image_4.png',
          
'link' => 'http://indiana.test001.com',
      ),
);

foreach (
$links as $link)
    echo 
'<a href="' $link['link'] . '"><img src="' $link['image'] . '" alt="" /></a>' "\r\n<br>";


:)
Jason Clemons
Former Team Member 2009 - 2012

Shambles

Don't you just hate some people  :laugh:

JBlaze

Jason Clemons
Former Team Member 2009 - 2012

Canadian_user

This worked almost perfectly but the 4 images are vertical. Is there a way to make them horizontal? Just like the image in my earlier post. Thank you very much

Kindred

get rid of the <br> in the code above...
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Advertisement: