Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#133 2009-10-22 12:21:26

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,271
Website GitHub

Re: smd_query: Talk to the database directly via SQL

pieman

Not sure it’s directly related to smd_query here because you get the same result if you remove the query and hard-code an article_custom tag. And you’re not using any replacement tags for the extra CFs.

Have you tried using Gerhard’s built-in custom field function:

<li><txp:glz_custom_field name="country" /></li>

?

Last edited by Bloke (2009-10-22 12:23:22)


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

#134 2009-10-22 19:35:15

pieman
Member
From: Bristol, UK
Registered: 2005-09-22
Posts: 491
Website

Re: smd_query: Talk to the database directly via SQL

Bloke wrote:

Not sure it’s directly related to smd_query here because you get the same result if you remove the query and hard-code an article_custom tag. And you’re not using any replacement tags for the extra CFs.
Have you tried using Gerhard’s built-in custom field function:
bc. <li><txp:glz_custom_field name=“country” /></li>

hmmm, I think maybe those tags have been deprecated – there’s no mention of them in the help of v1.2 or v1.2.3.

But you’re right, this isn’t an smd_query issue. Something a bit wonky going on elsewhere. Thanks anyway.

Offline

#135 2009-10-25 20:06:28

pieman
Member
From: Bristol, UK
Registered: 2005-09-22
Posts: 491
Website

Re: smd_query: Talk to the database directly via SQL

Back again :)

Is it possible with smd_query to limit the results to show future articles, as you’d do with time="future" on a normal article_custom call?

Offline

#136 2009-10-26 08:52:06

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,271
Website GitHub

Re: smd_query: Talk to the database directly via SQL

pieman wrote:

Is it possible with smd_query to limit the results to show future articles

You should be able to add AND Posted > NOW() to your query in order to do that.


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

#137 2009-11-05 16:06:46

pieman
Member
From: Bristol, UK
Registered: 2005-09-22
Posts: 491
Website

Re: smd_query: Talk to the database directly via SQL

Bloke wrote:

You should be able to add AND Posted > NOW() to your query in order to do that.

Thanks Stef. After a brief delay I finally got around to trying that, but it seems to have no effect.

This is what I’ve got

                  <txp:smd_query column='*' table='textpattern'
                    where='custom_1 LIKE "%<txp:article_id />%"
                    AND section="events" AND Posted > NOW() ORDER BY title desc LIMIT 1'
                  >
                  ...

Offline

#138 2009-11-13 01:48:45

whaleen
Member
From: Portland
Registered: 2006-05-11
Posts: 373
Website

Re: smd_query: Talk to the database directly via SQL

How can one return articles which can make use of all article tags and plugin tags that affect articles?

I’m realizing that I have to query each column that my form needs to show what it contains.

If in my page:

<txp:smd_query 
    column="id, section, custom_13, custom_12, custom_15, etc"
    table="textpattern"
    where="section='section1' AND custom_13='some-custom-stuff'"
    form="smd_query_crud" 
/>

And in smd_query_crud form:

This: {custom_13}
That: {custom_15}
ID: {id}
Other: {custom_12}
Section: {section}

I get:

This: Things
That: Thing
ID: #
Other: Thing
Section: some-section

I’m not able to place a <txp:modified /> tag in my form and get results for example. I wonder how to force the results to act like TXP Articles do natively when returned. Does this make sense? I want to include other aspects of the articles returned such as rss_unlimited_categories and potentially other stuff.

Last edited by whaleen (2009-11-13 01:52:11)


txtstrap (Textpattern + Twitter Bootstrap + etc…)

Offline

#139 2009-11-13 02:18:04

whaleen
Member
From: Portland
Registered: 2006-05-11
Posts: 373
Website

Re: smd_query: Talk to the database directly via SQL

I might do:

<txp:article_custom id='<txp:output_form name="smd_query_crud" />' form="another_form" />

with smd_query_crud made up of:

{id},

That might give me the ability to use another_form to call on tags like txp:modified and others.

I’m still F@#$!ed trying to sort by rss_unlimited_categories though, which is the real beef in my salad.


txtstrap (Textpattern + Twitter Bootstrap + etc…)

Offline

#140 2009-11-13 11:59:20

pieman
Member
From: Bristol, UK
Registered: 2005-09-22
Posts: 491
Website

Re: smd_query: Talk to the database directly via SQL

Bloke wrote:
You should be able to add AND Posted > NOW() to your query in order to do that.

For future reference, it needed this and time="all" on article_custom to work. Thanks Stef!

Offline

#141 2009-11-21 04:10:00

whaleen
Member
From: Portland
Registered: 2006-05-11
Posts: 373
Website

Re: smd_query: Talk to the database directly via SQL

Bloke wrote:

<txp:variable /> support so you can read values from those lovely things directly into a query instead of having to embed them tag-in-tag stylie and get hung up on quoting issues

And the following just plain isn’t working for me:

<txp:smd_query
column="custom_13, custom_23"
table="textpattern"
where="custom_13='<txp:variable name="thingy" />' AND custom_23='something'">

Showing all items with {custom_13} and {custom_23}

</txp:smd_query>

Are variables meant to be called in another fashion when in the smd_query context?


txtstrap (Textpattern + Twitter Bootstrap + etc…)

Offline

#142 2009-11-21 08:29:55

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,271
Website GitHub

Re: smd_query: Talk to the database directly via SQL

whaleen wrote:

Are variables meant to be called in another fashion when in the smd_query context?

Yes, if tags-in-tags doesn’t work, try the ? shortcut:

<txp:smd_query
column="custom_13, custom_23"
table="textpattern"
where="custom_13='?thingy' AND custom_23='something'">

Showing all items with {custom_13} and {custom_23}

</txp:smd_query>

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

#143 2009-11-25 02:49:31

whaleen
Member
From: Portland
Registered: 2006-05-11
Posts: 373
Website

Re: smd_query: Talk to the database directly via SQL

Bloke wrote:

Yes, if tags-in-tags doesn’t work, try the ? shortcut:

This smd_query will still not use that variable called thingy when trying the ? shortcut. Notice I’m running <txp:variable name="thingy" /> above and below the query in order to check that the variable exists. It does.

<txp:variable name="thingy" />

<txp:smd_query
column="custom_13, custom_23"
table="textpattern"
where="custom_13='?thingy' AND custom_23='something'">

Showing all items with {custom_13} and {custom_23}

</txp:smd_query>

<txp:variable name="thingy" />

Variations not working:

  1. custom_13='?thingy'
  2. custom_13='<txp:variable name="thingy" />'
  3. custom_13='<txp:smd_var_get name="<txp:ign_user_info type="name" />-thingy" />' (username-variable versions are kept server side)

Two Ways I make Vars

1. The way in which the thingy variable is created is by using the permanent stored variable from the server:

<txp:variable name="thingy" value='<txp:smd_var_get name="<txp:ign_user_info type="name" />-thingy" />' />

2. The one instance where this: custom_13='?thingy' or custom_13='<txp:variable name="thingy" />' will work is when I create the variable in this way:

if($_POST['t']){$GLOBALS['variable']['thingy']=implode(',',$_POST['t']);
}

Do you know why these different variables can only be used in certain contexts? When I say different I mean that there are three in my mind. 1) created by smd_vars 2) created by POST and 3) created by txp:variable.


txtstrap (Textpattern + Twitter Bootstrap + etc…)

Offline

#144 2009-11-25 10:23:30

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,304

Re: smd_query: Talk to the database directly via SQL

whaleen wrote:

Two Ways I make Vars […]

<txp:variable name="thingy" value='<txp:smd_var_get name="<txp:ign_user_info type="name" />-thingy" />' />

- – - – - – - – - – - – - –

Just to have a stab until experts show (me) up: Have you tried:

<txp:variable name="thingy" value='<txp:smd_var_get name=''<txp:ign_user_info type="name" />-thingy'' />' />

(Exchanged the double apostrophes around the ign tag for two times two single apostrophes.)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

Board footer

Powered by FluxBB