Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2015-06-08 10:41:42

MrViSiOn
Member
Registered: 2014-11-17
Posts: 26

output_form/article_custom with 'or' attribute

Hi:

How could I select articles with an attribute or another?

Like

<txp:output_form form=“media_form” section=“section1” ‘or’ custom_field=“custom_value_1”/>

Note that ‘or’ is something I don’t know how do this Is this possible? do I create a plugin for this?

Thank you

Offline

#2 2015-06-08 11:05:57

etc
Developer
Registered: 2010-11-11
Posts: 5,393
Website GitHub

Re: output_form/article_custom with 'or' attribute

Hi,

plugin (faster):

<txp:etc_query data="Section='section1' OR custom_n='custom_value_1' ORDER BY Posted DESC"
    form="media_form" markup="db" populate="article" />

or smd_query, or etc_search, or … if you need to paginate.

Core:

<txp:variable name="ids" value='<txp:article_custom section="section1" break=","><txp:article_id /></txp:article_custom>' />
<txp:variable name="idc" value='<txp:article_custom custom_field="custom_value_1" break=","><txp:article_id /></txp:article_custom>' />

<txp:article_custom id='<txp:variable name="ids" />,<txp:variable name="idc" />' form="media_form" sort="Posted DESC" />

Offline

#3 2015-06-08 12:13:47

MrViSiOn
Member
Registered: 2014-11-17
Posts: 26

Re: output_form/article_custom with 'or' attribute

Clever solution!

Like this…

Thank you so much

Offline

#4 2015-06-08 12:40:41

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,356
GitHub

Re: output_form/article_custom with 'or' attribute

MrViSiOn wrote #291416:

<txp:output_form form=“media_form” section=“section1” ‘or’ custom_field=“custom_value_1”/>

Also, watch your code punctuation – you have smart quotes going on (“” and ‘’ instead of " and ') – make sure your editor code doesn’t do that substitution.

Offline

#5 2015-06-08 12:48:00

MrViSiOn
Member
Registered: 2014-11-17
Posts: 26

Re: output_form/article_custom with 'or' attribute

Got it gaekwad.

Thank you!

Offline

#6 2015-06-08 12:49:06

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,315

Re: output_form/article_custom with 'or' attribute

Intersting question, I’d like to know what’s the idea behind this, output form is something totally different than article_custom. And which criterion is taken to decide the “or” switch?


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#7 2015-06-08 12:59:53

MrViSiOn
Member
Registered: 2014-11-17
Posts: 26

Re: output_form/article_custom with 'or' attribute

The ‘or’ switch is because custom_fields…

There is some articles with some custom_fields and others that belongs to certain category… I want to select/show both kinds.

Offline

#8 2015-06-08 13:58:36

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,315

Re: output_form/article_custom with 'or' attribute

MrViSiOn wrote #291425:

others that belongs to certain category… I want to select/show both kinds.

Ah, OK, a category set-up is clearer than the above section one.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#9 2015-06-08 18:40:11

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,477

Re: output_form/article_custom with 'or' attribute

MrViSiOn wrote #291425:

There is some articles with some custom_fields and others that belongs to certain category… I want to select/show both kinds.

So you can do it with <txp:article_custom /> and his attributes.

Offline

#10 2015-06-08 19:16:46

MrViSiOn
Member
Registered: 2014-11-17
Posts: 26

Re: output_form/article_custom with 'or' attribute

GugUser wrote #291427:

So you can do it with <txp:article_custom /> and his attributes.

No I can’t How would you do that with article_custom?

Offline

#11 2015-06-08 19:34:11

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,477

Re: output_form/article_custom with 'or' attribute

I think there are different ways. I know not enough about the context.

And how uli wrote: “And which criterion is taken to decide the ‘or’ switch?”

Offline

#12 2015-06-08 19:59:46

makss
Plugin Author
From: Ukraine
Registered: 2008-10-21
Posts: 355

Re: output_form/article_custom with 'or' attribute

<txp:output_form form=“media_form” section=“section1” ‘or’ custom_field=“custom_value_1”/>

Maybe article_custom+SQL_where ? :)

<txp:aks_article form="media_form" where="section='section1' or custom_1='custom_value_1' " />

Plugin aks_article


aks_cron : Cron inside Textpattern | aks_article : extended article_custom tag
aks_cache : cache for TxP | aks_dragdrop : Drag&Drop categories (article, link, image, file)

Offline

Board footer

Powered by FluxBB