Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-05-13 17:12:21

scdoody
Member
Registered: 2006-10-18
Posts: 129

Highlight specific section on front page

So I have a section called “Articles” and when people go to my home, I want “Articles” to be selected by default. In the section admin I checked yes for “selected by default” and “display on homepage” . . . but it is not selected by default when I go to my site. How can I achieve this?

To display section navigation, I am using this:

<div id=“globalnav”>
<txp:section_list active_class=“globalnav-on” break=“li” class=“globalnav” include_default=“0” wraptag=“ul” sections=“About,Thoughts,Work,Services,Contact” />
</div>

Thanks!!!

(Edit: updated discussion topic. -Mary)

Last edited by Mary (2007-05-13 23:36:34)

Offline

#2 2007-05-13 18:59:51

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Highlight specific section on front page

scdoody wrote:

So I have a section called “Articles” and when people go to my home, I want “Articles” to be selected by default. In the section admin I checked yes for “selected by default” and “display on homepage” . . . but it is not selected by default when I go to my site. How can I achieve this?

‘Selected by default’ means in the Write tab, so when you save a new article it is assigned to this section unless you choose another one.

‘Display on homepage’ means that the articles in this section are displayed on your home page, but it will still be your home page: domain.com.
Do you mean that when visitors request domain.com they are redirected to domain.com/articles/?

Offline

#3 2007-05-13 22:12:48

scdoody
Member
Registered: 2006-10-18
Posts: 129

Re: Highlight specific section on front page

Ideally I don’t want to have to redirect people to domain.com/articles – I just want the articles LI in my section to be highlighted when people are on domain.com/index.php – it this possible without redirection?

Offline

#4 2007-05-13 22:23:17

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Highlight specific section on front page

Ah, now I understand.

But where is your articles section in <txp:section_list active_class="globalnav-on" break="li" class="globalnav" include_default="0" wraptag="ul" sections="About,Thoughts,Work,Services,Contact" /> ?

What about something like

<txp:section_list active_class="globalnav-on" break="li" class="globalnav" include_default="1" default_title="Articles" wraptag="ul" sections="About,Thoughts,Work,Services,Contact" />

(I know it’s not perfect, but the only alternative I can think of is handcoding your section menu.)

Offline

#5 2007-05-13 23:12:02

scdoody
Member
Registered: 2006-10-18
Posts: 129

Re: Highlight specific section on front page

Oops – I should have mentioned that I renamed Articles to Thoughts. I added the default_title=“Thoughts” and it didn’t make the Thoughts section become selected on the homepage.

Offline

#6 2007-05-13 23:35:49

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: Highlight specific section on front page

Textbook: section_list

What you want to do isn’t possible. You can do:

<txp:section_list sections="About,Work,Services,Contact" include_default="1" default_title="Thoughts" wraptag="ul" break="li" class="globalnav" active_class="globalnav-on" />

Otherwise you’ll need a plugin.

Offline

#7 2007-05-14 00:28:08

scdoody
Member
Registered: 2006-10-18
Posts: 129

Re: Highlight specific section on front page

Ok I did this and it made the Thoughts section <li> be highlighted – but when I click the article (thoughts) title for a post, it goes to the individual article page – and then the Thoughts <li> is not highlighted anymore.

Does anyone know a plugin that will help achieve what I’m trying to do?

Offline

#8 2007-05-14 14:52:30

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Highlight specific section on front page

Why not handcode it? There are only five sections. This is one way to do it:

<ul>
   <li class="globalnav<txp:if_section name="about">-on</txp:if_section>">
         <txp:section name="about" title="1" link="1" />
   </li>
   <li class="globalnav<txp:if_section name=",thoughts">-on</txp:if_section>">
         <txp:section name="thoughts" title="1" link="1" />
   </li>
   <li class="globalnav<txp:if_section name="work">-on</txp:if_section>">
         <txp:section name="work" title="1" link="1" />
   </li>
   <li class="globalnav<txp:if_section name="services">-on</txp:if_section>">
         <txp:section name="services" title="1" link="1" />
   </li>
   <li class="globalnav<txp:if_section name="contact">-on</txp:if_section>">
         <txp:section name="contact" title="1" link="1" />
   </li>
</ul>

Offline

Board footer

Powered by FluxBB