Auto_LInk - how to add a class to the resulting link - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Auto_LInk - how to add a class to the resulting link (/showthread.php?tid=33949) |
Auto_LInk - how to add a class to the resulting link - El Forum - 09-14-2010 [eluser]JamesTaylor[/eluser] When using the Auto_Link function of the URL helper what is the best way to incorporate a class with the link that is created? I want to be able to style all Auto_Links in a specific manner via css so I would like to include class="AutoLink" into the output code but there doesn't appear to be an option to do so in the parameters it takes? Anyone else dealt with this issue before? Thanks James Auto_LInk - how to add a class to the resulting link - El Forum - 09-14-2010 [eluser]Georgi Budinov[/eluser] Straight from the User guide : Code: echo anchor('news/local/123', 'title="My News"'); so this get like : Code: echo anchor('news/local/123', 'class="autolink"'); Uuups didn't catch what you meant... Auto_LInk - how to add a class to the resulting link - El Forum - 09-14-2010 [eluser]JamesTaylor[/eluser] Georgi, i am not using the anchor tag to create links in this instance. I am using the auto_link tag and am wanting to achieve the equivilient to what you have shown. Auto_LInk - how to add a class to the resulting link - El Forum - 09-14-2010 [eluser]Georgi Budinov[/eluser] Yes I realized that OK no way as I see the problem! However you can overwrite the function by creating your own my_url_helper updating the code: Code: function auto_link($str, $type = 'both', $popup = FALSE, $customClass = FALSE) Not tested but something like this will help. |