Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2018-09-07 14:45:40
- jpdupont
- Member
- Registered: 2004-10-01
- Posts: 752
How reverse an article_custom attribute value ?
I made a semi automated archiving system for a site.
I place in the archives all the articles whose expiry date has passed + all the articles whose archiving is forced by selecting an option of a select box (glz_custom_fields) including the 5 positions of an article on the site.
With article_custom
I use expired="0"
for the expiration date. But how to use my custom_field position_article
by passing the correct attribute?
position_article="archive"
is OK to select what is voluntarily archived, but I want the opposite: select what is not archived (ie one of the 4 other values of my field position_article
. I wish to actually reverse this filter position_article="archive"
.
I see exclude
in the new 4.7 attribute.
Is it possible to do : exclude="position_article='archive'"
Last edited by jpdupont (2018-09-07 14:51:19)
Offline
Offline
#3 2018-09-07 16:43:33
- jpdupont
- Member
- Registered: 2004-10-01
- Posts: 752
Re: How reverse an article_custom attribute value ?
Perfect, Oleg! Thank you !
By the way, I’m going now with the new tag <txp:evaluate />
: a pleasure!
Offline
Re: How reverse an article_custom attribute value ?
Nice one! That’s another tidbit we need to save somewhere. Didn’t Oleg have a great “before 4.7, after 4.7” thread with similar improvements?
I recently came across a few of Oleg’s other simplifications while fixing the plugins site:
<txp:article_custom section="my_section" category="my_category" pageby="1" pgonly />
will give you the article count for your respective attribute contribution (obviating the need for mdn_count).
Bonus: changing pageby="{your_value}"
will show you the number of pages of results and can be helpful to determine if you need pagination or not.
And a replacement for the ancient glx_if_frontpage and the many multiple nested if_-tags to determine whether you are actually on the front page of the entire site.
<txp:if_section name="default">
<txp:if_article_list type="author, c, month, pg, q" not>
<!-- this is the front page of the entire site -->
</txp:if_article_list>
</txp:if_section>
Going through the textpattern plugins site – last properly updated in 2008 – made me aware of how far we have come over the years. Many plugins have been rendered obsolete through the incorporation of an added attribute and Oleg’s seemingly mini-additions here and there have made some tags much more flexible and more powerful than they were in the past. The only thing is, they were easier to recognise as plugins (which were named to solve a problem). Now we need to recognise the power of certain attribute combinations.
TXP Builders – finely-crafted code, design and txp
Offline
Re: How reverse an article_custom attribute value ?
jakob wrote #313908:
And a replacement for the ancient glx_if_frontpage and the many multiple nested if_-tags to determine whether you are actually on the front page of the entire site.
That is sweet. I am definitely going to incorporate that into my next design.
Offline
Re: How reverse an article_custom attribute value ?
jakob wrote #313908:
“before 4.7, after 4.7” thread with similar improvements
is here awaiting contributions. :-)
Many plugins have been rendered obsolete through the incorporation of an added attribute
Often we had no choice, e.g. mdn_count
did not take into account new or modified <txp:article />
attributes. And it was two lines of code to add to core vs duplicating a large core block in the plugin.
Offline