Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: smd_multi_choice: select... case conditional-based output
frickinmuck wrote:
The default recent articles list should only ever appear if all 4 of the variables are empty. It’s too bad there isn’t a way to check several variables at once
smd_if can :-)
Did you say your variables came from the result of a user-submitted url variable? If so:
<txp:smd_if field="urlvar:coveragemediaoutlet,urlvar:coveragetype,urlvar:coveragecause,urlvar:coverageclient" operator="isempty">
...
</txp:smd_if>
If you need to test txp:variables use txpvar
instead of urlvar
. You may also be better off with operator="undefined"
if testing URL vars directly.
I don’t know if this is too little too late (or completely irrelevant) but can people filter by more than one of the variables at once? If not, why don’t you combine them into a single variable, then you can use multiple smd_case statements and fallthru=“1” to test them all in sequence.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
#26 2011-07-08 18:59:03
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,311
Re: smd_multi_choice: select... case conditional-based output
frickinmuck wrote:
It’s too bad there isn’t a way to check several variables at once
I think it’s time to draw a new specialist plugin beneath the street lightings: cbe_if_variable.
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
#27 2011-07-09 01:38:18
- frickinmuck
- Member
- Registered: 2008-05-01
- Posts: 118
Re: smd_multi_choice: select... case conditional-based output
Of COURSE you have a solution up your sleeve, Stef! You just seem to be The Man! Thanks – it worked perfectly:
<txp:smd_if field="txpvar:coveragemediaoutlet,txpvar:coveragetype,txpvar:coveragecause,txpvar:coverageclient" operator="isempty">
<txp:article_custom section="coverage" form="article_listing" limit="3" />
</txp:smd_if>
No, there will only ever be one filter in use at a time. Coverage Type OR Coverage Client, etc. etc. But since this is working as desired now, I’m really happy with it as-is. Unless there’s some benefit to simplifying it besides the abstract value of “doing it correctly”. :^)
The AI does not hate you, nor does it love you, but you are made out of atoms which it can use for something else.
Offline
Re: smd_multi_choice: select... case conditional-based output
Feature request: a trim
attribute for txp:smd_switch
could come in handy when trying to exactly match (eq
) strings that may come with leading/trailing spaces.
Offline