Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Before/after 4.7 primer
Textpattern 4.7 introduces important new features (like themes, global attributes etc) that deserve each a separate discussion. But it also offers its users easier ways to achieve some common tasks that we briefly describe here.
Don’t pgonly
anymore
We need to display previous/next page links before the articles list:
Before
<txp:article pgonly="1" />
<txp:newer /> - <txp:older />
<txp:article />
After
<txp:newer /> - <txp:older />
<txp:article />
Say not
to lame <txp:else />
We need to hide some text under some condition, say in some section:
Before
<txp:if_section name="about">
<txp:else />
Not about section.
</txp:if_section>
After
<txp:if_section not name="about">
Not about section.
</txp:if_section>
Be valueless
Most of Boolean attributes 1
values can be skipped now:
Before
<txp:section link="1" title="1" />
After
<txp:section link title />
Adopt <txp:evaluate />
We need to display a breadcrumb only when corresponding articles exist:
Before
<txp:variable name="articles" value='<txp:article />' />
<txp:if_variable name="articles" value="">
<txp:else />
<txp:variable name="articles" />
<txp:breadcrumb />
</txp:if_variable>
After
<txp:evaluate test="article">
<txp:article />
<txp:breadcrumb />
</txp:evaluate>
Enjoy wraptag
new powers
We need to append a class pulled from some custom field:
Before
<txp:if_custom_field name="class"> class="<txp:custom_field name="class" />"</txp:if_custom_field>
After
<txp:custom_field name="class" wraptag=' class="<+>"' />
What else?
Please feel free to share if you discover something new!
Offline
Re: Before/after 4.7 primer
Yeah really cool features for devs!
Thanks guys for the hard work.
Offline
Re: Before/after 4.7 primer
Grouping articles (and other lists) is straightforward in 4.7:
<txp:article break="div" breakclass="group" breakby="2">
<article><txp:title /></article>
</txp:article>
Offline
Pages: 1