Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2011-10-01 18:59:44

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

Re: Display articles from multiple related category

convoy wrote:

No, smd_if doesn’t need article context, that’s why I find it useful to parse any smd_query results.

To be truthful you’re both right: smd_if does require article context if you want to test article fields, but if you’re not testing them then it doesn’t.

To further confuse things, unlike the native tags, if it can’t find a given variable under test (e.g. trying to test a custom field in a non-article context) it’ll probaby just fail silently and always return a FALSE result, instead of throwing an error like the native tag does. That could be considered a bug depending on your standpoint but since the tag’s general purpose nature is so, well, general purpose, I couldn’t test for that explicitly without some awkward code so I left it down to you to make sure everything you’re testing is valid and in context.

What you’re describing, however, is possible to do with native tags. Look at smd_query’s populate attribute. If you set it to populate="article" and change your column attribute to:

column="*, unix_timestamp(Posted) as uPosted, unix_timestamp(LastMod) as uLastMod, unix_timestamp(Expires) as uExpires"

then native tags will work inside smd_query’s form/container. You only need to change the column because this version of the plugin predates a core change that allows plugin authors to simplify the syntax. Once I get round to issuing the next version you won’t need to add those stupid extra columns as the core will take care of extracting them on your behalf.

The query parameter is optional for non-SELECT or complex query.

Correct. FYI Uli, simple mode doesn’t require query as you can use column, table and where instead.


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