CodeIgniter Forums
New url_helper anchor tag that allows for an image link - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: New url_helper anchor tag that allows for an image link (/showthread.php?tid=48523)

Pages: 1 2


New url_helper anchor tag that allows for an image link - El Forum - 01-19-2012

[eluser]InsiteFX[/eluser]
A lot of people on the forums have been asking how to create an anchor with an image
so here you go.

Can use as a normal anchor tag or pass in an image.
Save code to application/helpers/MY_url_helper.php

Download MY_url_helper




New url_helper anchor tag that allows for an image link - El Forum - 01-19-2012

[eluser]CroNiX[/eluser]
I like that. You should request a pull.


New url_helper anchor tag that allows for an image link - El Forum - 03-07-2012

[eluser]Paleleaves[/eluser]
Really helpful..This is what exactly I'm looking for.. thank you!


New url_helper anchor tag that allows for an image link - El Forum - 05-22-2012

[eluser]piddleton[/eluser]
Howdy, I'm a CI newb and found this thread on a search.

Will this function allow you to anchor an image with an href while not showing the anchor text?

I have the anchor function working with an image, but I can't seem to get the link text to disappear. Tried removing the 2nd parm and using blank quotes in the anchor function but to no avail.




New url_helper anchor tag that allows for an image link - El Forum - 05-22-2012

[eluser]InsiteFX[/eluser]
give me a few minutes and I will add that options to it!

UPDATED: 2012-05-22

Added new flag for imgage only link.
Code:
$img_only = TRUE/FALSE

Set to TRUE for just an image link tag

Re-download from link above!



New url_helper anchor tag that allows for an image link - El Forum - 05-22-2012

[eluser]piddleton[/eluser]
Wow, thanks so much!! :-)


New url_helper anchor tag that allows for an image link - El Forum - 05-22-2012

[eluser]InsiteFX[/eluser]
Please let me know if that is working the way you want or if you need anything else added to.



New url_helper anchor tag that allows for an image link - El Forum - 05-22-2012

[eluser]piddleton[/eluser]
[quote author="InsiteFX" date="1337710272"]Please let me know if that is working the way you want or if you anything else added to.
[/quote]

It worked beautifully! At first CI couldn't find the function because I erroneously put it in the system/helpers folder instead of application/helpers.

So I guess any custom helper functions need to go in application/helpers? Is that customizeable in any of the config files? Just curious how CI knows to go there...

Thanks again!!


New url_helper anchor tag that allows for an image link - El Forum - 05-22-2012

[eluser]CroNiX[/eluser]
Basically, you should never have to touch the /system directory. Everything outside of the stock CI having to do with your application goes in /application.


New url_helper anchor tag that allows for an image link - El Forum - 05-22-2012

[eluser]piddleton[/eluser]
[quote author="CroNiX" date="1337713083"]Basically, you should never have to touch the /system directory. Everything outside of the stock CI having to do with your application goes in /application.[/quote]

Got it, thanks for the clarification.