Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#331 2018-06-26 15:51:02

jeroenvg
Member
From: netherlands
Registered: 2010-04-21
Posts: 33

Re: smd_query: Talk to the database directly via SQL

jeroenvg wrote #311942:

does smd_query cache results?

think i found what’s going on. from looking at mysql query log, i can see smd_query asking for the current score from my table when the page with html form is rendered. but for the (new, uncached) ‘thank you’ page, the query is not repeated.

so, the ‘thank you’ page gets the counter value somewhere else. could it be that they’re carried over from the html form?

if so, is there a way to clear smd_query values beforehand, to make the ‘thank you’ page query my table again?

Offline

#332 2018-08-31 08:28:40

aslsw66
Member
From: Canberra, Australia
Registered: 2004-08-04
Posts: 342
Website

Re: smd_query: Talk to the database directly via SQL

I’m back in the land of Textpattern after a long break!

I have a page that returns results from the database – in this case, a list of incidents. I have a form that allows the user to filter the list according to the type of incident – a fire, a community event or a controlled burn. Or everything. The form posts the selection in a URL variable called ‘type’.

Here’s my code so far:

<txp:smd_query query="SELECT id, date_format (date_out,'%d/%m/%Y') as date, type, description, location FROM gck_incidents where type like '?type' order by date_out desc" limit="25" urlfilter="/(\ball\b)/" defaults="type:%" pageform="page_info"> 

This works perfectly for any selected value, but if the user leaves the value as the default of ‘all’ then nothing is returned. I’m still trying to figure out regular expressions so I know this needs more work to stop users adding anything else they want to the URL. But for testing purposes it would be good to at least get this working.

Last edited by aslsw66 (2018-08-31 08:29:20)

Offline

#333 2019-12-30 11:04:18

demoncleaner
Plugin Author
From: Germany
Registered: 2008-06-29
Posts: 106
Website

Re: smd_query: Talk to the database directly via SQL

Just in case the world is not aware of it… I just found out that this beautiful peace of code will unfortunately not work anymore under textpattern 4.8. (beta) It will just output nothing.

Offline

#334 2019-12-30 13:26:56

gaekwad
Admin
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 3,076

Re: smd_query: Talk to the database directly via SQL

demoncleaner wrote #320759:

I just found out that this beautiful peace of code will unfortunately not work anymore under textpattern 4.8. (beta) It will just output nothing.

I am sure Stef (bloke) will be able to make it work again, he’s that kind of guy.

Offline

#335 2019-12-30 15:07:28

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 9,637
Website

Re: smd_query: Talk to the database directly via SQL

The plugin tag just needs registering. I can do that and release an update as soon as I can, but if you want to do it yourself in the meantime, see the tag registering example.


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

#336 2020-01-02 16:20:54

demoncleaner
Plugin Author
From: Germany
Registered: 2008-06-29
Posts: 106
Website

Re: smd_query: Talk to the database directly via SQL

Perfect. Will have a look at it. Thank you so much!

Offline

#337 2020-01-03 13:23:23

etc
Developer
Registered: 2010-11-11
Posts: 3,772
Website

Re: smd_query: Talk to the database directly via SQL

I would expect many front-side plugins to stop working in 4.8. But it’s the third txp version since introducing tags registry, the authors had almost four years to update their plugins.

Online

#338 2020-01-04 00:31:02

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 9,637
Website

Re: smd_query: Talk to the database directly via SQL

etc wrote #320798:

the authors had almost four years to update their plugins.

Okay okay, guilty! I’ll get it fixed :)


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

#339 2020-05-16 06:43:47

demoncleaner
Plugin Author
From: Germany
Registered: 2008-06-29
Posts: 106
Website

Re: smd_query: Talk to the database directly via SQL

Sorry to come up with this again, but I run into the same problem again and I did not really manage to solve it the last time. I took a look at the post tag registering but I have no clue where to register it or where to put what exactly in case of smd_query. Can you help please?

Offline

#340 2020-05-16 10:20:25

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 9,637
Website

Re: smd_query: Talk to the database directly via SQL

Sorry for the huge delay. I’ve finally released smd_query v0.6.0 which brings with it tag registration as well as <txp:smd_query_info /> tag which you can use instead of the {replacement} syntax for added power and flexibility.


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

Board footer

Powered by FluxBB