Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-04-21 17:25:52

wii
Member
Registered: 2005-05-08
Posts: 77

class="current" ?

Hi, I created a simple website with only 5 pages, the only difference between the templates are a class=“current” in the navigation to show the current site, is there another way to do this, so I just have 1 template ?

Thanks

Offline

#2 2007-04-21 17:35:40

hcgtv
Plugin Author
From: Key Largo, Florida
Registered: 2005-11-29
Posts: 2,722
Website

Re: class="current" ?

I did this in a form:

<li <txp:if_section name="about"> 
class="active" </txp:if_section>>
<a href="<txp:site_url />about/">About
<span class="tab-l"></span><span class="tab-r"></span></a>
</li>

Offline

#3 2007-04-21 17:59:54

wii
Member
Registered: 2005-05-08
Posts: 77

Re: class="current" ?

hmm, how does it look in the template then ?

Offline

#4 2007-04-21 18:05:50

mapu
Member
From: Munich, Germany
Registered: 2004-03-16
Posts: 141

Re: class="current" ?

You could use the active_class attribute of the section_list tag.

Offline

#5 2007-04-21 18:11:21

hcgtv
Plugin Author
From: Key Largo, Florida
Registered: 2005-11-29
Posts: 2,722
Website

Re: class="current" ?

wii, maybe you could past your code in this thread, easier to point you in the right direction.

mapu, I tried the active_class for a section list but I remember having problems when I was on the Home page.

Offline

#6 2007-04-21 18:20:47

mapu
Member
From: Munich, Germany
Registered: 2004-03-16
Posts: 141

Re: class="current" ?

hcgtv wrote:

mapu, I tried the active_class for a section list but I remember having problems when I was on the Home page.

I’m using it without any problems on TXP Templates with the following code:

<txp:section_list active_class="active" break="li" default_title="Home" include_default="1" sections="template,article,instructions,about,contact"/>

Offline

#7 2007-04-21 18:38:01

hcgtv
Plugin Author
From: Key Largo, Florida
Registered: 2005-11-29
Posts: 2,722
Website

Re: class="current" ?

mapu wrote:

I’m using it without any problems on TXP Templates with the following code:

Hey, that works, I must of missed something, thanks.

Now I remember why I did it the way I posted above, it’s because the template I was creating used span to create the rounded corners on the navigation bar.

Offline

#8 2007-04-21 18:50:03

wii
Member
Registered: 2005-05-08
Posts: 77

Re: class="current" ?

Ok, my HTML looks something like this:

<li><a href=”/” class=“current” title=“Home”>Home</a></li>
<li><a href=”/page1” title=“Page 1”>Page 1</a></li>
<li><a href=”/page2” title=“Page 2”>Page 2</a></li>

So, I have the class=“current” to show the active page.

How exactly do I write this into a form and template.

Thanks

Offline

#9 2007-04-21 18:58:49

mapu
Member
From: Munich, Germany
Registered: 2004-03-16
Posts: 141

Re: class="current" ?

wii, you should really try to make use of TXP’s advantages and use sections for your pages and the tags offered by TXP.

Offline

#10 2007-04-21 19:08:24

wii
Member
Registered: 2005-05-08
Posts: 77

Re: class="current" ?

OMG, that was easy, my above example would be like this:

<txp:section_list active_class=“current” break=“li” default_title=“Home” include_default=“1” sections=“page1,page2”/>

Thanks

Offline

#11 2007-05-15 19:53:55

wii
Member
Registered: 2005-05-08
Posts: 77

Re: class="current" ?

By the way, I tried doing this for pages only, as I don´t really need to use sections, like this:

<txp:page_list active_class=“current” break=“li” default_title=“Home” include_default=“1” pages=“page1,page2”/>

Any way to do this without sections ?

Offline

Board footer

Powered by FluxBB