Welcome Guest, Not a member yet? Register   Sign In
New url_helper anchor tag that allows for an image link
#11

[eluser]Aken[/eluser]
Should be useful for those people who are still having trouble grasping how to pass an image to the anchor() function.

There are some things I would recommend cleaning up / changing, if you're interested in hearing them. Don't want to just list them off because people usually think I'm a jackass when I do that, even though they're suggestions on how to better the code.
#12

[eluser]InsiteFX[/eluser]
I ahve not done anything to the code , It is the url helper code I just added the code for the image.
#13

[eluser]Aken[/eluser]
That's one of my points. You already have access to the URL helper, why repeat code that's already there? Your function should only need to adjust what ends up being the $title parameter, then pass everything to and return anchor().

Something worth noting to users, also, is that some browsers (*cough* Internet Explorer) don't play well with img tags that do not have width and height attributes. As handy as this function might be to people, I would recommend creating the img tag either by hand or with the HTML helper img() function, with all appropriate attributes added. Then this function or anchor() can be used.
#14

[eluser]skunkbad[/eluser]
I think in the past I just used something like this:

Code:
echo anchor('whatever.php', img('x.gif') );
#15

[eluser]adityamenon[/eluser]
skunkbad, that will probably just give you a link, whose text is the HTML for an image tag.

InsiteFX, here's the gist for your post. It allows forking so others can act on their suggestions...
#16

[eluser]Unknown[/eluser]
[quote author="adityamenon" date="1338154422"]skunkbad, that will probably just give you a link, whose text is the HTML for an image tag.

InsiteFX, here's the gist for your post. It allows forking so others can act on their suggestions...[/quote]

Actually, I was searching for a solution just like this. skunks code works perfectly.

Code:
<?=anchor('publications/bvbride/2012/fall', img('images/bvbride-2012-fall.jpg'), 'title="Brazos Valley Bride - Fall 2012 Digital Edition"');?>

...yields...

Code:
<a href="http://bryanbroadcasting.com/publications/bvbride/2012/fall" title="Brazos Valley Bride - Fall 2012 Digital Edition"><img src="http://bryanbroadcasting.com/images/bvbride-2012-fall.jpg" alt=""></a>




Theme © iAndrew 2016 - Forum software by © MyBB