Welcome Guest, Not a member yet? Register   Sign In
Anchor Text - Can you hide it? (URL Helper)
#1

[eluser]Barwick[/eluser]
Is there anyway to hide the anchor text of the <a> generated by CI? I know I could hide this via CSS (i.e. negative text-indent), but that seems like a lot of unnecessary work. Why wouldn't I just use a regular HTML coded anchor?

Cheers,
Mike
#2

[eluser]noslen1[/eluser]
[quote author="Mike Barwick" date="1352125699"]...but that seems like a lot of unnecessary work.[/quote]

It's about 1 or 2 lines max of CSS and you already know the hack, I don't think this is too much work. And if you put the CSS rule into an ".hidden" class, it is reusable elsewhere.

Don't think CI can handle this, since it is a styling issue, it's about CSS.
#3

[eluser]Barwick[/eluser]
Why use CI's shortcut then? What's the benefit? A regular anchor is the same amount of text really lol and I wouldn't need to fiddle with CSS on it.
#4

[eluser]noslen1[/eluser]
It is just a helper... I agree you don't need to use it, but it helps to write correct urls.
Instead of writing and dealing with your base app
Code:
<a href="&lt;?=base_url('controller/function/param')?&gt;">My link</a>
Or worse, dealing with your domain :
Code:
<a href="http://www.domain.com/controller/function/param">My link</a>
No matter where you are, will always be correct, you just have
Code:
&lt;?=anchor('controller/method/param', 'My link')?&gt;

I do prefer use this url helper instead of pure HTML.
#5

[eluser]boltsabre[/eluser]
>> Why use CI’s shortcut then? What’s the benefit?
It's used to speed up development, once you are used to it's syntax it is a lot shorter than typing a regular anchor tag that it is in vanilla html with the href attribute, opening and closing tag, backslash, etc.

There is no reason you cannot code your anchor tags in regular html... some people like it, others dont, I use a combination of either depending on how I'm feeling that day and what I want to achieve. If I don't need a title or css class, id attribute, etc, the helper is much shorter.

>> A regular anchor is the same amount of text really lol and I wouldn’t need to fiddle with CSS on it.
This just makes no sense... regardless of if you use the helper function or vanilla html, if you want to apply a css class to it you have to.... ummm... apply it, unless I'm missing your point completely?

>> Is there anyway to hide the anchor text of the <a> generated by CI? I know I could hide this via CSS (i.e. negative text-indent)
Is there a legitimate reason you need to do this? If you want traffic from the search engines this kind of behaviour is against their TAC and won't help your rankings in the slightest!!!
#6

[eluser]Barwick[/eluser]
[quote author="boltsabre" date="1352128401"]>> Why use CI’s shortcut then? What’s the benefit?
It's used to speed up development, once you are used to it's syntax it is a lot shorter than typing a regular anchor tag that it is in vanilla html with the href attribute, opening and closing tag, backslash, etc.

There is no reason you cannot code your anchor tags in regular html... some people like it, others dont, I use a combination of either depending on how I'm feeling that day and what I want to achieve. If I don't need a title or css class, id attribute, etc, the helper is much shorter.

>> A regular anchor is the same amount of text really lol and I wouldn’t need to fiddle with CSS on it.
This just makes no sense... regardless of if you use the helper function or vanilla html, if you want to apply a css class to it you have to.... ummm... apply it, unless I'm missing your point completely?

>> Is there anyway to hide the anchor text of the <a> generated by CI? I know I could hide this via CSS (i.e. negative text-indent)
Is there a legitimate reason you need to do this? If you want traffic from the search engines this kind of behavior is against their TAC and won't help your rankings in the slightest!!![/quote]

Thanks you, you make some valid points. I'll prob do the same as you and use it when appropriate. Most of my anchor's CSS are universal across the board and I want to avoid writing individual anchor CSS classes - just for the sake of using CI's helper, you know?

And the reason is nothing to do with search engines lol, I have anchors on DIVs and images, etc. Which in my case, don't require anchor text.
#7

[eluser]Barwick[/eluser]
[quote author="noslen1" date="1352128293"]It is just a helper... I agree you don't need to use it, but it helps to write correct urls.
Instead of writing and dealing with your base app
Code:
<a href="&lt;?=base_url('controller/function/param')?&gt;">My link</a>
Or worse, dealing with your domain :
Code:
<a href="http://www.domain.com/controller/function/param">My link</a>
No matter where you are, will always be correct, you just have
Code:
&lt;?=anchor('controller/method/param', 'My link')?&gt;

I do prefer use this url helper instead of pure HTML.
[/quote]

Thanks man! I like the simplicity of the CI anchor shortcut, just wanted to know if there was an inline way to exclude anchor text in the shortcut.




Theme © iAndrew 2016 - Forum software by © MyBB