Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2007-06-08 18:37:12
- moskyt
- New Member
- Registered: 2007-06-08
- Posts: 1
URL with title="" in section_list
Hi…
I have main menu on my page which is made from tag: <txp:section_list include_default=“0” break=“li” wraptag=“ul” /> and then, in resulting html I have:
<div id=“menu”>
<ul class=“section_list”>
<li><a href=”/section1/”>section1</a></li>
<li><a href=”/section2/”>section2</a></li>
<li><a href=”/section3/”>section3</a></li>
<li><a href=”/section4/”>section4</a></li>
<li><a href=”/section5/”>section5</a></li>
<li><a href=”/section6/”>section6</a></li>
<li><a href=”/section7/”>section7</a></li>
</ul>
</div>
It´s OK with one exception. I need links with attribute title=”“ in this appearance:
<div id=“menu”>
<ul class=“section_list”>
<li><a href=”/section1/” title=“section1”>section1</a></li>
<li><a href=”/section2/” title=“section2”>section2</a></li>
<li><a href=”/section3/” title=“section3”>section3</a></li>
<li><a href=”/section4/” title=“section4”>section4</a></li>
<li><a href=”/section5/” title=“section5”>section5</a></li>
<li><a href=”/section6/” title=“section6”>section6</a></li>
<li><a href=”/section7/” title=“section7”>section7</a></li>
</ul>
</div>
Is some technique for this result?
Offline
#2 2007-06-08 21:33:58
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: URL with title="" in section_list
<txp:section_list />
doesn’t do that (yet?), though I agree it should. You can either handcode the links, or there may be a menu plugin that adds titles.
Offline
#3 2007-06-08 22:35:43
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: URL with title="" in section_list
Er, that would actually not be correct to have the title twice (once in the title attribute and once as the link text itself).
Offline
Re: URL with title="" in section_list
Already proposed in “Features Request”.
Personaly, I’d changed “taghandler.php” file and added a “tooltip” attribute associated with the $title variable within the function section_list.
I’ve got the rule.
Patrick.
Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.
Offline
#5 2007-06-09 12:14:44
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: URL with title="" in section_list
Mary wrote:
Er, that would actually not be correct to have the title twice (once in the title attribute and once as the link text itself).
Mary, I agree, but wouldn’t it be preferable to not having a title attibute at all? I may be wrong of course. Ideally one should be able to set a title per section, but I can see that’s a little difficult in just one tag ;)
Patrick
Would you mind sharing what you changed in taghandlers.php?
Offline
Re: URL with title="" in section_list
@Els,
Of course, yes.
In the “taghandlers.php” file, just add a new attribute named “tooltip” within the function section_list :
extract(lAtts(array( 'active_class' => '', 'break' => br, 'class' => __FUNCTION__, 'default_title' => $sitename, 'exclude' => '', 'include_default' => '', 'label' => '', 'labeltag' => '', 'sections' => '', 'wraptag' => '', 'tooltip' => '', ), $atts));
then, few lines below, just modify the tad render :
$out[] = tag($title, 'a', ( ($active_class and ($s == $name)) ? ' class="'.$active_class.'"' : '' ). ' href="'.$url.'" title="'.$tooltip.' “'.$title.'”"' ); } if ($out) { if ($include_default) { $out = array_merge(array( tag($default_title,'a', ( ($active_class and ($s == 'default')) ? ' class="'.$active_class.'"' : '' ). ' href="'.hu.'" title="'.$tooltip.' '.$title.'"' ) ), $out); } return doLabel($label, $labeltag).doWrap($out, $wraptag, $break, $class);
Now, when you declare your section_list, you can use :
<txp:section_list tooltip="Acces to the page" />
That’s it. You’ve got your tooltip following by the section’s title.
Your can also use it for all the list TXT tags like: category_list.
I post all my tips on this tread : French forum, Trucs, tips et astuces
(Sorry in french. I suppose you can translate it with Google translate tool)
Cheers,
Last edited by Pat64 (2007-06-10 07:53:50)
Patrick.
Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.
Offline
#7 2007-06-10 17:46:51
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: URL with title="" in section_list
Great, thanks Patrick. You could also use it with asy_wondertag like this:
<txp:section_list tooltip="Acces to page <txp:section />" />
Offline
#8 2007-06-11 03:06:49
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: URL with title="" in section_list
…wouldn’t it be preferable to not having a title attibute at all?
We, no, it isn’t. Why would it be? The purpose of a title attribute is for extended information, an elaboration of what the link is. At best it is redundant, but I am pretty sure it would annoy the hell out of screen readers: for every link that does that it would read the link to them twice. Think about it, even Patrick’s example suffers from it: “About, Access to page About. Contact, Access to page Contact. Articles, Access to page Articles. Archives, Access to page Archives.”. If all sites started doing that and I couldn’t use a conventional browser… I’d soon stop “reading” as many sites as I do.
I understand and agree with providing useful title attributes, but this makes no sense to me at all. If you really want to do it for a given site I won’t argue the point, but I would advise against this practise.
Offline
#9 2007-06-11 15:10:00
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: URL with title="" in section_list
Thanks for explaining Mary. You are right of course! (off to remove some superfluous title attributes…)
Last edited by els (2007-06-11 15:11:07)
Offline
Re: URL with title="" in section_list
I’ve editted taghandlers.php as iota adviced, but txp tells it doesn’t know param tooltip in section_list… May be there is some cache at hoster or txp engine?
Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?
Offline
Re: URL with title="" in section_list
Yeah. I’ve done this, but there is still a problem – it addes the same attribute “title” to all items of section links!
<ul>
<li><a href=“http://www.okoshki.by/” title=“About company”>Main</a></li>
<li><a class=“selected” href=“http://www.okoshki.by/about/” title=“About company”>About company</a></li>
<li><a href=“http://www.okoshki.by/article/” title=“About company”>Technical</a></li>
<li><a href=“http://www.okoshki.by/catalog/” title=“About company”>Catalog</a></li>
<li><a href=“http://www.okoshki.by/contact/” title=“About company”>Cantact info</a></li>
<li><a href=“http://www.okoshki.by/news/” title=“About company”>Read news</a>
</li></ul>
In thix example i used this form:
<txp:asy_wondertag>
<txp:section_list include_default=“1” default_title=“Main” break=“li” active_class=“selected” tooltip=”<txp:section title=“1” />”/>
</txp:asy_wondertag>
So, there is the way to use only the same title attributes for section_list links?
Is there way to add to section manage tab 1 option where I could enter disiarable title?
Last edited by the_ghost (2007-07-29 10:57:19)
Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?
Offline
Re: URL with title="" in section_list
Patrick.
Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.
Offline