Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2013-12-24 21:34:20
- bornpilot
- Member
- Registered: 2010-09-30
- Posts: 11
if_section
Greetings, So I am working on some navigation items for a theme and the <txp:if_section> fails to work. I am trying to use font awesome to have icons before each section. I am using the default sections “about” and “articles” however both sections are reverting to the <txp:else /> areas. Any Suggestions?
Thanks,
Tim Here is my code
<txp:section_list break="">
<li class="drawer-list-item" name='<txp:section />'>
<txp:section title="1" link="1" >
<txp:if_section name="about">
<i class="fa fa-coffee"></i>
<txp:section title="1" />
</txp:if_section>
<txp:if_section name="articles">
<i class="fa fa-book"></i>
<txp:section title="1" />
<txp:else />
<i class="fa fa-bolt"></i>
<txp:section title="1" />
</txp:if_section>
</txp:section>
</li>
</txp:section_list>
Offline
#2 2013-12-24 22:44:51
- GugUser
- Member
- From: Quito (Ecuador)
- Registered: 2007-12-16
- Posts: 1,477
Re: if_section
It’s not <txp:if_section>
that doesn’t work. You’re using it wrong.
If you need an identifier for each <li>
element, then you can do that with the section name as class. That’s all what you need for styling.
For example:
<txp:section_list wraptag="ul" class="drawer-list" break="">
<li class="<txp:section /><txp:if_section name='<txp:section />'> current"><txp:section title="1" /><txp:else />"><txp:section title="1" link="1" /></txp:if_section></li>
</txp:section_list>
Edit 1: Added the missing </txp:if_section>
.
Edit 2: Someone has changed the code in the initial post.
Last edited by GugUser (2013-12-25 02:18:25)
Offline
Re: if_section
GugUser wrote #277531:
<code><txp:section_list wraptag="ul" class="drawer-list" break="">...
That is how its done, but that example snippet is missing the closing if_section tag.
If you need an identifier for each <li> element, then you can do that with the section name as class. That’s all what you need for styling.
FontAwesome is, well, font. If you want to use it like that, you will need to use pseudo before selector and content to apply it to the menu. If you use FontAwesome’s LESS (or Sass too) codebase and mixins you can simply do something along the lines of:
.my-menu-selector {
li:before {
.fa();
}
.about:before {
content: @fa-var-coffee;
}
.articles:before {
content: @fa-var-umbrella;
}
}
Or you can use the raw CSS from the FontAwesome’s CSS file, and apply it similarly.
Offline
#4 2013-12-25 00:49:16
- GugUser
- Member
- From: Quito (Ecuador)
- Registered: 2007-12-16
- Posts: 1,477
Re: if_section
Gocom wrote #277532:
That is how its done, but that example snippet is missing the closing if_section tag.
That’s true. Sorry, I wrote it down too fast.
BTW: The subscription for this and other posts doesn’t work.
Offline
#5 2013-12-25 01:03:10
- beammeupscotty
- New Member
- Registered: 2013-03-06
- Posts: 4
Re: if_section
So, do subscription work?
Offline
Re: if_section
Subscriptions do work:
beammeupscotty has replied to the topic ‘If_section Please Help’ to which you are subscribed. There may be more new replies, but this is the only notification you will receive until you visit the board again.
The post is located at http://forum.textpattern.com/viewtopic.php?pid=277536#p277536
Offline
#7 2013-12-25 01:16:06
- beammeupscotty
- New Member
- Registered: 2013-03-06
- Posts: 4
Re: if_section
But what if the message is included?
Offline
Re: if_section
Including message works too:
The message reads as follows:
———————————————————————————————————-But what if the message is included?
———————————————————————————————————-
Sorry for invading the thread. Had to test the subscriptions as it was brought up. If subscriptions do not work for you, make sure:
- The sender, or our server IP, is not blacklisted or banned.
- Check your trash/spam.
- Keep in mind that notifications are sent only once. At maximum you should be getting single email per thread until you visit the forum again. You don’t get notification about subsequent updates.
Offline
#9 2013-12-27 18:38:07
- bornpilot
- Member
- Registered: 2010-09-30
- Posts: 11
Re: if_section
So, I got what I needed working with the following. I used GoCom’s suggestion with CSS for the variable data rather than using markup html/txp.
Thanks for all the help
<txp:section_list break="">
<li class="drawer-list-item" name="<txp:section />">
<a href="<txp:section name="" url="1" />">
<i class="fa <txp:section />-font"></i>
<txp:section title="1" />
</a>
</li>
</txp:section_list>
{Edited to add Textile’s bc.
for indentation and straight quotes. – Uli}
Last edited by uli (2013-12-27 19:09:27)
Offline
Pages: 1