Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-03-31 23:38:03

alivato
Member
Registered: 2011-03-31
Posts: 151

home page - active section

My English is very poor.

I have a problem with active in menu

Code in my page:

~
<txp:output_form form=“menubar” />
~
<div id=“content”> <txp:article limit=“6”/>
</div>
~

Code form:

<div id=“menubar”>
<ul id=“menu”>
<txp:section_list wraptag=”“ break=”“ include_default=“1” default_title=“Dendy” exclude=“Dendy” sort=“page” >
<li<txp:if_section name=’<txp:section />’> class=“active” </txp:if_section>>
<txp:section title=“1” link=“1” />
</li>
</txp:section_list>
</ul>
</div>

include_default=“1” – show my default page
default_title=“Dendy” change name
exclude=“Dendy” hide Dendy section in menu

So now, my Default(Dendy) page = Dendy section, but if i open any article(full) in section Dendy, class=“active” menu disappears

How to solve this problem?

Did you understand anything from what I wrote. )))
Sorry.

Last edited by alivato (2011-04-03 02:31:52)

Offline

#2 2011-04-01 00:49:58

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 1,000
Website

Re: home page - active section

If the section named Dendy is excluded from the section list, then the section list would have no way of identifying it in the section list, whether it’s active or not.

I think you might want something like this:

<txp:variable name="this_section"><txp:section/></txp:variable>
<txp:section_list wraptag="" break="" include_default="1" default_title="Dendy" exclude="Dendy" sort="page">
<li<txp:if_section name='<txp:variable name="this_section/>' class="active"</txp:if_section>>
...

The trouble with the code you posted is that Textpattern can’t identify the section of the current page as section from within a section_list — in section_list context, a txp:section tag returns the current section being iterated by the list.

If that doesn’t help, it could be I misunderstood your question.

Offline

#3 2011-04-01 01:54:16

alivato
Member
Registered: 2011-03-31
Posts: 151

Re: home page - active section

I do not know, maybe I’m doing something wrong. But I is not working.
A pity.

In my code:
Does not work only ‘active’ for the full article section ‘default’

Last edited by alivato (2011-04-01 02:14:44)

Offline

#4 2011-04-01 03:37:42

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: home page - active section

Not sure if I’ve understood your requirements properly but it sounds like you need different section_list attributes on different pages.

For example on home/default page, use what you’ve got:

<txp:section_list wraptag=”“ break=”“ include_default=“1” default_title=“Dendy” exclude=“Dendy” sort=“page” >

- so you get the default page listed as “Dendy” but the real Dendy section link is missing

but on other pages use:

<txp:section_list wraptag=”“ break=”“ sort=“page” >

- this time the default page is omitted but the real Dendy link is listed – which should then be shown as active.

Offline

#5 2011-04-01 04:03:19

alivato
Member
Registered: 2011-03-31
Posts: 151

Re: home page - active section

How to make
Home (Dendy) section = Dendy section

All this is done in order to earn the ‘active’
__________________
My English is very poor.

Offline

#6 2011-04-01 04:20:37

alivato
Member
Registered: 2011-03-31
Posts: 151

Re: home page - active section

One wise man said that it can be implemented using the plug smd_if v0.9
But I did not get
?

Offline

#7 2011-04-01 05:30:30

maruchan
Member
From: Ukiah, California
Registered: 2010-06-12
Posts: 596
Website

Re: home page - active section

I suggest that you try a simple method first. Please look at this tutorial. The tutorial shows you how to assign the active class. For example:

<ul id="main_menu">
<li><a href="<txp:site_url />articles" <txp:if_section name="articles">class="active" </txp:if_section>>Articles</a></li>
<li><a href="<txp:site_url />archive" <txp:if_section name="archive">class="active" </txp:if_section>>Archive</a></li>
<li><a href="<txp:site_url />contact" <txp:if_section name="contact">class="active" </txp:if_section>>Contact</a></li>
</ul>

If this works for you, maybe you can try again with section list. If this does not work for you, maybe there’s a hidden problem.

Offline

#8 2011-04-01 05:38:23

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: home page - active section

That’s pretty much how I’m doing the same thing. But a little simpler.

<txp:section_list exclude="my,list,of,excluded,sections" break="" wraptag="ul" default_title="Home" 
include_default="1">
<li <txp:if_section name='<txp:section />'>class="active"</txp:if_section>>
<txp:section title="1" link="1" /></li>
</txp:section_list>

My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

#9 2011-04-01 05:43:13

alivato
Member
Registered: 2011-03-31
Posts: 151

Re: home page - active section

maruchan Yes I know this method, but I would use <txp:section_list>

Offline

#10 2011-04-01 06:00:56

alivato
Member
Registered: 2011-03-31
Posts: 151

Re: home page - active section

MattD
Sorry, but this does not work.

I did not pay attention.
It’s just the same as what I wrote.
And it’s not working as well as created a section in the menu.

I need advice, ahhh

Last edited by alivato (2011-04-02 23:26:54)

Offline

#11 2011-04-01 06:56:46

alivato
Member
Registered: 2011-03-31
Posts: 151

Re: home page - active section

I need advice, ahhh

Last edited by alivato (2011-04-02 23:27:09)

Offline

#12 2011-04-02 23:38:37

alivato
Member
Registered: 2011-03-31
Posts: 151

Re: home page - active section

MattD wrote:

That’s pretty much how I’m doing the same thing. But a little simpler.

<txp:section_list exclude="my,list,of,excluded,sections" break="" wraptag="ul" default_title="Home" 
include_default="1">
<li <txp:if_section name='<txp:section />'>class="active"</txp:if_section>>
<txp:section title="1" link="1" /></li>
</txp:section_list>

If I remove ‘home page’ include_default=“0”, can do so at the opening of the site active section was Dandy.

or

if include_default=“1” excerpt article default page Dendy was active.

Last edited by alivato (2011-04-02 23:39:10)

Offline

Board footer

Powered by FluxBB