Go to content Go to navigation Go to search

TXP admin search mod · Wednesday November 16, 2005 by Gerhard Lazu

This is one of the many TXP tips & tricks that I have been using successfully for quiet a while now, but never made it public. Even if you knew it, here it goes.

Before proceeding, please note that this tutorial is based on the latest version of TXP (namely 4.0.2 r1076) at the time of publishing.

Open up textpattern/include/txp_list.php and take a look at lines 58-62:

'title_body' => "Title rlike '$crit' or Body rlike '$crit'",
'author'     => "AuthorID rlike '$crit'",
'categories' => "Category1 rlike '$crit' or Category2 rlike '$crit'",
'section'    => "Section rlike '$crit'",
'status'     => "Status = '".(@$sesutats[$crit])."'"

replace them with

'title_body' => "Title rlike '$crit' or Body rlike '$crit'",
'section'    => "Section rlike '$crit'",
'categories' => "Category1 rlike '$crit' or Category2 rlike '$crit'",
'custom_1' => "Custom_1 rlike '$crit'",
'custom_2' => "Custom_2 rlike '$crit'",
'author'     => "AuthorID rlike '$crit'",
'status'     => "Status = '".(@$sesutats[$crit])."'"

The second part that needs replacing can be found around line 136:

'title_body' => gTxt('title_body'),
'author' => gTxt('author'),
'section' => gTxt('section'),
'categories' => gTxt('categories'),
'status' => gTxt('status')

with

'title_body' => gTxt('title_body'),
'section' => gTxt('section'),
'categories' => gTxt('categories'),
'custom_1' => gTxt('Custom1'),
'custom_2' => gTxt('Custom2'),
'author' => gTxt('author'),
'status' => gTxt('status')

Custom1 and Custom2 can be replaced with whatever you think is more appropriate for your set-up (maybe Language, Price etc.). If you aren’t using Custom1 and Custom2, you can omit these lines from both mods.

Experiment because possibilities are plenty. Believe me, this hack is really handy when it comes to filtering articles by criteria that aren’t present in the out-of-the-box TXP.

Name
E-mail
http://
Message
  Textile Help

...