Welcome Guest, Not a member yet? Register   Sign In
img() with link?
#1

[eluser]jurlan[/eluser]
hi all.
I have the following piece of code:

Code:
<?php

$image_properties = array(array('src' => 'assets/images/blah.gif',
       'alt' => 'Blah',
       'width' => '67',
       'height' => '25',
       'title'  => 'Blah'));


foreach ($image_properties as $val)
{
echo(img($val));
}
?>

There will be 4 images in the array.
Is there any way I can add a link to each image that will be in the array?

Thanks in advance!
#2

[eluser]noslen1[/eluser]
What about
Code:
echo anchor('where_to_go', img($val));
?
#3

[eluser]jurlan[/eluser]
yes, but where to put the 'where_to_go' in the array for each image?
#4

[eluser]egy_programozo[/eluser]
like this:
Code:
foreach ($image_properties as $val)
{
$src = $val['src'];
unset($val['src']);
echo anchor($src, img($val));
}
#5

[eluser]jurlan[/eluser]
Oh my ... I just have known that :/

Code:
echo(anchor($href, img($val), 'target="_blank"'));

Does the trick Smile
Thanks a lot mister!




Theme © iAndrew 2016 - Forum software by © MyBB