Create link with 'name' attribute only using l() function Is it possible to create a link using Drupal's l() function without an href? For example, I'd like to create a link like the following:

&lt;a name="my-anchor"&gt;A link here&lt;/a&gt;


However, this seems to not be possible. The closest I can come is to use the following:

l(t('A link here'), '', array('external' =&gt; TRUE, 'attributes' =&gt; array('name' =&gt; 'my-anchor')));


This outputs:

&lt;a href name="my-anchor"&gt;A link here&lt;/a&gt;


... and that's not valid HTML. It also causes slightly strange behavior in some browsers depending on the CSS applied...
Sadly this cannot be accomplish with the l function because the href is hard-coded in the theme_link theme function.

You can accomplish this by using the html_tag theme function.

It'll look something like this

return theme('html_tag', array('element' =&gt; array('#tag' =&gt; 'a', '#value' =&gt; 'A link here', '#attributes' =&gt; array('name' =&gt; 'my-anchor'))));


This will return 

&lt;a name="my-anchor"&gt;A link here&lt;/a&gt;


Is a bit more work, but it does give you a properly formatted a tag with out the href.