Textpattern Forum

You are not logged in. Register | Login | Help

#1 2004-10-11 20:31:33

osei
Plugin Author
From: Stockholm, Sweden
Registered: 2004-07-01
Posts: 178
Website

[archived] glx_hl_current highlight current article

Notice: This thread is archived, this can be achieved with a combination of txp tags.

**********************************************************

This plugin highlights the current article or current section.

Download v.0.4

More info and example

Attribute
<code>class</code>
The value youd like assigned to the class property of the current selected article or section
Default: <code>current </code>

<code>section</code> Only for glx_hl_current_section
The section you want to compare to. It takes a commaseparated list if you want to compare to several sections

glx_hl_current_article
Just use it like this in a form

<code>
<li<txp:glx_hl_current_article />>
<txp:permlink><txp:title /></txp:permlink>
</li>
</code>

glx_hl_current_section
Just use it like this in a form or in a page template

<ul id="menu">
<li<txp:glx_hl_current_section section="default, article" />><a href="/">Start</a></li>
<li<txp:glx_hl_current_section section="archive" />><a href="/archive">My archive</a></li>
<li<txp:glx_hl_current_section section="contact" />><a href="/contact">Contact</a></li>
</ul>

edit: plugin updated

Copy/Paste Plugin

YToxMDp7czo0OiJuYW1lIjtzOjE0OiJnbHhfaGxfY3VycmVudCI7czo2OiJhdXRob3IiO3M6MTM6IkpvaGFuIE5pbHNzb24iO3M6MTA6ImF1dGhvcl91cmkiO3M6MjQ6Imh0dHA6Ly9qb2hhbi5nYWxheGVuLm5ldCI7czo3OiJ2ZXJzaW9uIjtzOjM6IjAuMyI7czoxMToiZGVzY3JpcHRpb24iO3M6NTg6IkFzc2lnbnMgYSBjbGFzcyB0byB0aGUgY3VycmVudCBzZWxlY3RlZCBhcnRpY2xlIG9yIHNlY3Rpb24iO3M6NDoiaGVscCI7czoxNzA5OiI8aDI+QXR0cmlidXRlczwvaDI+Cgo8ZGw+Cgk8ZHQ+PGNvZGU+Y2xhc3M8L2NvZGU+PC9kdD4KCTxkZD5UaGUgdmFsdWUgeW91ZCBsaWtlIGFzc2lnbmVkIHRvIHRoZSBjbGFzcyBwcm9wZXJ0eSBvZiB0aGUgY3VycmVudCBzZWxlY3RlZCBhcnRpY2xlIG9yIH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son

Offline

#2 2004-10-15 02:02:49

hafnius
Plugin Author
From: DK
Registered: 2004-09-02
Posts: 47

Re: [archived] glx_hl_current highlight current article

Cool – this might come in handy for me.
/Hafnius


– Nobody puts Baby in the corner !
Johnny Castle, Dirty Dancing

Offline

#3 2004-10-20 08:37:06

osei
Plugin Author
From: Stockholm, Sweden
Registered: 2004-07-01
Posts: 178
Website

Re: [archived] glx_hl_current highlight current article

I made an update to this plugin.

Now it comes with two tags, one to check current article and one to check the current section

See first post.

note that the tag <code><txp:glx_hl_current /></code> now is gone and should now be <code><txp:glx_hl_current_article /></code> instead.


Johan Nilsson

Offline

#4 2005-01-18 09:24:30

osei
Plugin Author
From: Stockholm, Sweden
Registered: 2004-07-01
Posts: 178
Website

Re: [archived] glx_hl_current highlight current article

New version 0.4

  • Corrected some typos in the documentation that was found by andreas.

Johan Nilsson

Offline

#5 2005-01-18 13:45:08

lee
Member
From: Normandy, France
Registered: 2004-06-17
Posts: 831

Re: [archived] glx_hl_current highlight current article

I must have missed this one when it came out. I’ll be using this a lot. Many thanks.

Offline

#6 2005-06-28 23:08:09

sekhu
Member
Registered: 2005-05-12
Posts: 428
Website

Re: [archived] glx_hl_current highlight current article

this sounds great, any chance it could be expanded to include categories as well as sections? so that if the current page selected is either a cat or section then it should highlight the link? in my case i am using two sections in the nav, and the others are pages which are assigned to cats which i want to highlight too.

Offline

#7 2006-03-10 12:18:38

creativesplash
Member
From: Coimbatore, India
Registered: 2005-01-19
Posts: 283
Website

Re: [archived] glx_hl_current highlight current article

Can you please make this plugin work for txp 4.03! (Doesnt seem to work!)


“Take a point, stretch it into a line, curl it into a circle, twist it into a sphere, and punch through the sphere.”

— Albert Einstein

Offline

#8 2006-03-21 06:08:34

tenthumbs
Member
Registered: 2004-11-22
Posts: 19

Re: [archived] glx_hl_current highlight current article

I can’t get it working either (glx_hl_current_article that is)

Offline

#9 2006-04-10 18:25:56

Nell
Member
From: Mexico City, Mexico
Registered: 2005-06-21
Posts: 48

Re: [archived] glx_hl_current highlight current article

The correct use is txp:glx_hl_current_article and not txp:glx_if_current_article, as the help suggests.

This solved the problem for the person who suggested it in Johan’s blog, but it’s still not working for me. Or maybe I’m not using it correctly.

I’m using it to highlight the current article in in a navigation list. Here’s an example (the markup was simplified):

<code><ul>
<li id=“dogs”><a href=”/pets/dogs”<txp:glx_hl_current_article class=“selected” />>Dogs</a></li>
<li id=“cats”><a href=”/pets/cats”<txp:glx_hl_current_article class=“selected” />>Cats</a></li>
</ul></code>

Is this the correct use for this plugin?

Thank you.

Last edited by Nell (2006-04-11 14:17:59)

Offline

Board footer

Powered by FluxBB