Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-02-12 07:08:13

rhino
New Member
Registered: 2011-02-12
Posts: 5

remove text in anchor tags in section list

I am using a sprite for my navigation so the “text” of the anchor tag is just a background image. However, if I’m putting my anchor tags in an <li> that’s wrapped in a section list, I don’t see how I can remove the <txp:section /> tag from inserting text into the anchor tag.

Here is what the plain html looks like (before applying to textpattern):

<div id="nav"> 
  <ul>
    <li class="currentPage"><a href="index.html" class="home"></a></li>
    <li><a href="about.html" class="about"></a></li>
    <li><a href="shop.html" class="shop"></a></li>
    <li><a href="blog.html" class="blog"></a></li>
  </ul> 
</div>

Notice there is no text inside the anchor tags.
———————————————————————————————————————————————————————————

Then this is what I’m doing with the txp section list:

<txp:section_list default_title='<txp:text item="home" />' include_default="1" wraptag="ul" break="">      
  <li<txp:if_section name='<txp:section />'> class="currentPage"</txp:if_section>>
      <txp:section link="1" title="1" class='<txp:section />' />
  </li>
</txp:section_list>

which produces the exact same output except it automatically places the text inside the txp tags:

<div id="nav">
  <ul>
    <li class="currentPage"><a href="index.html" class="*default*">*Home*</a></li>
    <li><a href="about.html" class="about">*About*</a></li>
    <li><a href="shop.html" class="shop">*Shop*</a></li>
    <li><a href="blog.html" class="blog">*Blog*</a></li>
  </ul> 
</div>

Is there anyway I can exclude text, or is this something textpattern forces upon you?

Also, notice how I have class=“default” on my Home link, well I want that to be named home, can I overwrite that, or not?

Any help is much appreciated, thanks!

Last edited by rhino (2011-02-12 07:12:10)

Offline

#2 2011-02-12 08:51:41

tye
Member
From: Pottsville, NSW
Registered: 2005-07-06
Posts: 859
Website

Re: remove text in anchor tags in section list

Use css

#nav ul li {text-indent: -10000;}

The the text is still there for SEO, but the image is displayed in place

Offline

#3 2011-02-12 08:53:52

rhino
New Member
Registered: 2011-02-12
Posts: 5

Re: remove text in anchor tags in section list

Thanks tye, yeah I am currently using that. You’re right, I would never typically try to use 100% images and sprites. However, the way it was designed (fonts, etc) and the client likes how it is. So I am using that. But I just was wondering if text pattern forces you to have a value there.

Offline

#4 2011-02-12 12:28:10

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: remove text in anchor tags in section list

rhino wrote:

But I just was wondering if text pattern forces you to have a value there.

No. “ section can be used as a container tag, in which case the tag contents become the link text. You can’t leave it completely blank or it will put in the section name anyway, but you could put just a space.


Code is topiary

Offline

Board footer

Powered by FluxBB