Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-03-09 01:18:52

marios
Archived Plugin Author
Registered: 2005-03-12
Posts: 1,253

New tag attribute for <txp:section_list />

The <code><txp:section_list /></code> tag is a very convenient tag.Having a linked section list and li wrapping is very good ,however
what is missing are two very important tag variables.
1) a class attribute on the current selected li element of the selected section.(User defined.That one might be a little easear.)
2) A current_section_no/show attribute.

Now, you might ask yourself, why for sake should there be a current_section_no/show attribute?
That’s worth some explanation.
You might want to need to generate logical main navigational blocks, where the current selected li item does not link to itself.
For example, let’s say you are on the default frontpage, the home would be something like this:
<code><li class=“current”><strong>Home</strong></li></code>
Then on each section front page the home page link would be hyperlinked, but each section li item would be like above.

This under current circumstances doeesn’t seem to be possible with TXP native tags,even not with conditionals and would require a plugin with the ability to filter and discard of the current selected section list element before the section names get wrapped up with their HTML.

I have looked into taghandles, but it would be very difficult for me with my very linited php knoledge to write such a plugin.
And allso it would be even better to have it as a core feature.

NOTE.:The section_list tag as is would only make sense for secondary navigation blocks that are on page templates that do not have a currently selected li item e.g.:landing page.

regards, marios

(Edit: updated your thread title, any html in them is escaped, so you don’t have to worry about wrapping it in code tags. :) -Mary)

Last edited by Mary (2006-03-09 01:52:55)


⌃ ⇧ < ⌃ ⇧ >

Offline

#2 2006-03-09 14:24:36

segfault
Plugin Author
From: Panama
Registered: 2004-05-21
Posts: 18
Website

Re: New tag attribute for <txp:section_list />

1) a class attribute on the current selected li element of the selected section.(User defined.That one might be a little easear.)

You can do this currently using the ako_nav plugin. I do think that this is functionality that might be better put into the < txp:section_list / > tag as you suggest though.

2) A current_section_no/show attribute.

Not quite sure what you mean… Maybe a link or not link attirbute? If that is the case then ako_nav handles that too.

Cheers!
Antonio

Last edited by segfault (2006-03-09 14:25:22)


“A hero is no braver than an ordinary man, but he is braver five minutes longer.” – Ralph Waldo Emerson

Offline

#3 2006-03-09 14:47:23

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: New tag attribute for <txp:section_list />

The suggested features (by marios) would be great, and I would also like to see some kind of sort attribute.
Maybe, this “sort” feature should not be added directly as an attribute to <txp:section_list /> tag.

What I suggest is: to have the possibility of sorting the sections directly from “presentation -> sections
Maybe, adding a “weight” number or using a list with all sections that give the possibility to sort them as desired.

Then, the <txp:section_list /> should reflect that order in the output.

I havent find any use for txp:section_list yet, because unordered sections isnt what I need.

thanks!


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#4 2006-03-09 17:32:15

marios
Archived Plugin Author
Registered: 2005-03-12
Posts: 1,253

Re: New tag attribute for <txp:section_list />

@segfault:

reg.:1)The ako_nav plugin, can only generate lists of sections that it knows about internally and thus requires you to supply these as attribute values, in opposition to rdt_dynamenous and mdp_section_menu that do access global variables to find the sections that textpattern knows about.

reg.:2)Yes, the ako_nav does have a no link option, but still, with what I try to explain above you can not get the <code><strong></code> in there which would be needed in your CSS file so you can style your active list Item (The one that is <strong>not</strong> hyperlinked.

@maniqui

I think what you suggest is pretty much imortant too.(And the section_list_tag could be considered as one of the most important tag,so why shouldn’t it have a sortby attribute?

I personally try to think about it in this way:Article tags, that do have all sort of attriubutes usually come third in terms of hierarchy of a Site Structure.The section tags are essential to structure on topmost and secondary level and yet lack the flexibility that article or category tags have.

In general as short turn workaround,what I am after is the ability to filter out the current selected section from the section list and then on a section front page I could do :

<code><ul><li class=“current”><strong><txp:s /></strong></li><txp:plg_pluginname break=“li” wraptag=“0” current=“noshow” /></ul></code>

I hope this was a little clearer,

regards, marios

Last edited by marios (2006-03-09 17:35:03)


⌃ ⇧ < ⌃ ⇧ >

Offline

#5 2006-03-09 17:45:44

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: New tag attribute for <txp:section_list />

marios,

in the meanwhile, you can try to achieve it by using built-in txp tags.

<code>
<ul>
<txp:if_section name=“about”>
<li class=“current”><strong><txp:section name=“about” title=“1” link=“0” /></strong></li>
<txp:else />
<li><txp:section name=“about” title=“1” link=“0” /></li>
</txp:if_section>
<txp:if_section name=“about”>
<li class=“current”><strong><txp:section name=“about” title=“1” link=“0” /></strong></li>
<txp:else />
<li><txp:section name=“about” title=“1” link=“0” /></li>
</txp:if_section>
….
</ul>
</code>

You can pick more ideas from here: http://forum.textpattern.com/viewtopic.php?pid=100124#p100124


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#6 2006-03-09 17:57:41

marios
Archived Plugin Author
Registered: 2005-03-12
Posts: 1,253

Re: New tag attribute for <txp:section_list />

Yes, updating all the page templates manually with conditionals seems the only option at hand for now.Thanks for your examples.
As a small brainstorming on this topic, I would consider ID’s and name attributes on the anchor elements as obsolete for such a tag feature request.

regards marios


⌃ ⇧ < ⌃ ⇧ >

Offline

#7 2006-05-04 15:14:08

rossharvey
Member
From: Earth. Sometimes.
Registered: 2005-03-16
Posts: 233
Website

Re: New tag attribute for <txp:section_list />

I’ve wanted this for a long while, but using ID’s (to highlight active section tab).

Can’t be that difficult, especially considering that TXP is ‘section-aware’, you need only add a class to it. Either that, or be able to add an ID prefix, for example:

<code><txp:section_list break=“li” prefix=“nav-” /></code>
<br />
The idea is that is puts ‘nav-{section name}’, hence:

<code><li id=“nav-services”><a href=”/Services/”>Services</a></li></code>
<br />

Would also be good to be able to add a <code>title</code> attribute, that automatically puts the Sitename, then Section/article (configurable like ob1_title):

<code><txp:section_list break=“li” prefix=“nav-” title=”%s %a” /></code>
<br />
giving:<br />

<code><li id=“nav-services”><a href=”/Services/” title=“MySiteName Services”>Services</a></li></code>
<br />

Last edited by rossharvey (2006-05-04 15:14:40)

Offline

Board footer

Powered by FluxBB