Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2009-08-26 05:26:54
- tennapel
- Member
- Registered: 2009-05-31
- Posts: 62
Pointer needed: callback functios or influencing the query
I have got a question. I’m looking for a good tutorial explaining how you can influence the query that is being used by textpattern to retrieve everything between txp:article
tags, or txp:article_custom
tags. I like to add extra where clauses, depending of the POST
results of a form.
If that is not possible, is there a way to use callback functions to filter the array of data retrieved after the execution of the sql, but before the page is being send to the browser?
What I want to do is make a form that has the distinct values of a custom field, and when a user selects a value in the form, the article output must be filtered for that chosen value.
Offline
Re: Pointer needed: callback functios or influencing the query
tennapel wrote:
influence the query that is being used by textpattern to retrieve everything between
txp:article
tags, ortxp:article_custom
tags.
There are no callbacks that you can use drectly inside either tag. The only one that might be of use (if you really want to go this way!) is textpattern_end which will allow you to search ‘n’ replace the rendered HTML. Messy.
What I want to do is make a form that has the distinct values of a custom field, and when a user selects a value in the form, the article output must be filtered for that chosen value.
Couple of ways you can do this:
- use smd_query (a few implementation ideas)
- use smd_if to filter the output of article/article_custom. A few tips ‘n’ tricks
There are probably others; those are just off the top of my (foggy) head. Hope some of that is useful.
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
#3 2009-09-02 20:46:00
- tennapel
- Member
- Registered: 2009-05-31
- Posts: 62
Re: Pointer needed: callback functios or influencing the query
smd_query is EXACTLY what I need reading your page, that saves me a lot of writing, especially being able to pass $_SERVER variables, I’m a very grateful person!
I haven’t tested it yet, so I might be a little less gratefull tomorrow :-)
Offline