txp:article_custom - patch "where"


Extend core txp:article_custom tag.
Added where attribute.

Download: patched publish.php or use Diff for publish.php
WARNING: This patch for TxP 4.2 ONLY !

Forum thread

This patch extend core txp:article_custom tag.

Changes:

  • Added new attribute where – it’s true sql “where” in txp:article_custom tag.

Install

1. Download publish.php WARNING: This patched file for TxP 4.2 ONLY !
2. Extract and replace file /textpattern/publish.php
3. Enjoy. :)

Warning: after upgrade TxP need upgrade patch too. :)

Sample of use:

Get articles with some conditions

 <txp:article_custom form="myform" where="custom_1 > 10 and custom_1 <=100" section="mysection" sort="Title asc" />
 <txp:article_custom form="myform" where="custom_1 > custom_2+custom_3" section="mysection" sort="Title asc" />

Create index for articles per letters A, B, C… etc.

1. Create index section “list”
2. Create articles in section “list” with title named as A, B
3. Add in default form code

( Upd: Code is corrected. Thanks Gocom )

<txp:if_article_section name="list">
<txp:article_custom form="myform" limit="999" where='Title like(''<txp:title />%'') and Section<>''list''' sort="Title asc" />
</txp:if_article_section>

4. Show index menu

<txp:article_custom section="list" sort="Title asc" limit="99"><txp:permlink><txp:title /></txp:permlink> </txp:article_custom>

It’s all.