Textpattern CMS support forum

You are not logged in. Register | Login | Help

#91 2009-04-09 17:57:36

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,493
Website

Re: smd_query: Talk to the database directly via SQL

eivl wrote:

<txp:smd_query query="SELECT DISTINCT events.event_id, events.title,events.description, dates.date, dates.event_id,dates.end_date from events,dates WHERE events.event_id=dates.event_id and  dates.end_date > now() order by dates.end_date asc">
   <txp:permlink>{title} {description} {date} {end_date} </txp:permlink>
</txp:smd_query>

Hmmm query looks OK to me and you’re using good replacement {} vars. One thing you will need to address is that the permlink won’t know which article to link to because you haven’t told it about anything in the TXP database. The permlink needs an article ‘context’ or a forced ‘id’ of an article to link to, and since you’re only using the ‘dates’ and ‘events’ tables it will do nothing.

However, that won’t explain why debug="2" gives you nothing out. I would expect at the very least to see ++ QUERY RESULT SET ++ shown and a list of matching rows; especially since the query works in phpMyAdmin. This is a puzzler.

As you found, the tag trace shows that the entire smd_query tag is being ignored when the > now() is present in the attribute; the tag is entirely missing from your first trace. That implies that the plugin is choking on the syntax, which is odd because I’ve done things like that before and it’s worked. *ponder*

EDIT: e.g.

query="select * from textpattern where Posted > now()"

works for me. I wonder if it is the dots causing the problem, though the plugin does nothing more than throw your entire query at the internal getRows() function which can definitely handle this kind of thing.

Last edited by Bloke (2009-04-09 18:03:47)


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

#92 2009-04-09 18:03:16

eivl
Member
Registered: 2009-04-09
Posts: 20

Re: smd_query: Talk to the database directly via SQL

would it help you to see if the page or be given an user on my TXP site?

i realy have no clue why >now() is making the query skipp it without posting anything in debug..

is this right btw ; <txp:smd_query debug=“2” query=“SELECT DISTI………. ?

Offline

#93 2009-04-09 18:05:34

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,493
Website

Re: smd_query: Talk to the database directly via SQL

eivl wrote:

i realy have no clue why >now() is making the query skipp it without posting anything in debug..

Me neither, it’s freaky.

would it help you to see if the page or be given an user on my TXP site?

The latter would help yes, if you don’t mind. Drop me a note and I’ll send you my email address

Last edited by Bloke (2009-04-09 18:08:42)


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

#94 2009-04-09 18:09:11

eivl
Member
Registered: 2009-04-09
Posts: 20

Re: smd_query: Talk to the database directly via SQL

cant find a send message button here, can i email you?

EDIT:

Done! =)

Last edited by eivl (2009-04-09 18:14:57)

Offline

#95 2009-04-09 18:20:27

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,493
Website

Re: smd_query: Talk to the database directly via SQL

Howzat now? Looks like it’s fixed to me. I think the problem was that you had the smd_query embedded directly in an article. Textile was coming along, processing the contents of the tag and trashing the > bit. Setting the Advanced Options -> Article markup dropdown on the left of the Write tab to Leave text untouched seems to have solved it. Please confirm if that’s dong what you expect now.

Last edited by Bloke (2009-04-09 18:21:25)


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

#96 2009-04-09 18:23:55

eivl
Member
Registered: 2009-04-09
Posts: 20

Re: smd_query: Talk to the database directly via SQL

Bloke wrote:

Howzat now? Looks like it’s fixed to me. I think the problem was that you had the smd_query embedded directly in an article. Textile was coming along, processing the contents of the tag and trashing the > bit. Setting the Advanced Options -> Article markup dropdown on the left of the Write tab to Leave text untouched seems to have solved it. Please confirm if that’s dong what you expect now.

=)

I belive i have to kiss you! (or maby i can send my wife)

Thanks, it works like a charm now. didnt know article markup was scr@wing around.

you realy should have an donate link on your webpage! =)

Offline

#97 2009-04-09 18:28:18

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,493
Website

Re: smd_query: Talk to the database directly via SQL

eivl wrote:

I belive i have to kiss you! (or maby i can send my wife)

lol! Glad it works now. I’d completely forgotten about article markup destroying tags like that. For future reference, it does the same to stuff inside <txp:php> tags.

you realy should have an donate link on your webpage! =)

I do ;-)


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

#98 2009-04-09 19:16:48

eivl
Member
Registered: 2009-04-09
Posts: 20

Re: smd_query: Talk to the database directly via SQL

There, an Amazon package will arive you after easter.. =)

—-
Edit

Delivery #1: 1 item – delivery estimate: 17 April 2009 – 21 April 2009

Last edited by eivl (2009-04-09 21:20:40)

Offline

#99 2009-04-09 19:35:44

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,493
Website

Re: smd_query: Talk to the database directly via SQL

eivl wrote:

There, an Amazon package will arive you after easter.. =)

Thank you very much! Looking forward to it.


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

#100 2009-04-11 09:23:49

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,493
Website

Re: smd_query: Talk to the database directly via SQL

Forgot to post this a while back. Minor update available that adds $_SERVER variable support so you can make queries based on servery things.

Download


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