Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#25 2009-07-04 03:16:40

artagesw
Member
From: Seattle, WA
Registered: 2007-04-29
Posts: 227
Website

Re: Specify article_custom limit AND check for non-empty custom field?

LIKE and the “%” and “_” characters are standard SQL, but not always consistently implemented. Also, the assumption that the semantics of a tag attribute are equal to the semantics of SQL is not necessarily a good one. It can make for fragile code. Tags serve as an intermediary between you and the storage engine (database) for a reason. Pierce that veil at your own risk. ;)

Offline

#26 2009-07-04 11:57:06

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: Specify article_custom limit AND check for non-empty custom field?

There’s also sort. Used to be split into sortby and sortdir attributes; now we’re expected to put valid ORDER BY expressions into sort. Having separate attributes is, I think, closer to your idea of tags as intermediary. Which I agree with, but I also agree with keeping the number of attributes in check. Something’s gotta give.

And there’s smd_query. Probably lots of MySQL-specific Txp code out there now. Again, I’m not saying this is good in itself, but by gum it works. Undoubtedly some of us will have some extra work, some day, prepping an existing site for conversion to a different DB engine. But probably not much. The smd_where_used plugin will be a handy helper for that task…


Code is topiary

Offline

#27 2009-07-04 17:10:56

artagesw
Member
From: Seattle, WA
Registered: 2007-04-29
Posts: 227
Website

Re: Specify article_custom limit AND check for non-empty custom field?

jsoo wrote:

There’s also sort. Used to be split into sortby and sortdir attributes; now we’re expected to put valid ORDER BY expressions into sort.

Yeah, there do seem to be a few instances where database dependency has crept into core. Not a good thing IMHO.

And there’s smd_query. Probably lots of MySQL-specific Txp code out there now.

Sure, but that’s a plugin, and plugins are by definition a compatibility risk. I’m more concerned with the core and being able to move it forward effectively without breaking existing sites.

Offline

#28 2009-07-05 02:09:12

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: Specify article_custom limit AND check for non-empty custom field?

artagesw wrote:

Yeah, there do seem to be a few instances where database dependency has crept into core. Not a good thing IMHO.

Oh, yeah, conditionals or a parser for the values, which IMHO makes it more limited and slower.

artagesw wrote:

plugins are by definition a compatibility risk.

Lol’d.

Offline

#29 2009-07-05 03:20:12

artagesw
Member
From: Seattle, WA
Registered: 2007-04-29
Posts: 227
Website

Re: Specify article_custom limit AND check for non-empty custom field?

Gocom wrote:

Oh, yeah, conditionals or a parser for the values, which IMHO makes it more limited and slower.

By that argument, you might as well throw away the entire Textpattern tagging system and write straight PHP for your templates. Compared with PHP, Textpattern tags are slow (require an additional layer of parsing) and limited. But there are benefits to tags that outweigh these costs, so we trade off some performance and flexibility to gain these benefits.

artagesw wrote:

plugins are by definition a compatibility risk.

Gocom wrote:

Lol’d.

It’s true. Plugins are essential, yes. But when you decide to use them, you must be prepared for potential problems down the road. From Textbook:

When a webmaster uses a plugin to achieve a goal on its website, if that goal is “critical” then he should seriously think it through. Because if:

  • a new Textpattern version breaks the plugin
  • the plugin is not maintained anymore
  • a security flaw is discovered with it

and the plugin author does not (or can’t) fix it, the site may not function as you intend.

Offline

#30 2009-07-05 03:44:09

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: Specify article_custom limit AND check for non-empty custom field?

artagesw wrote:

gain these benefits.

But we need to weight the benefits. And IMHO, I wouldn’t put that little sort value in the category of benefits. Also it will disable MySQL version destricted hacks, that for examle right now make some websites work. For example sorting of varchar fields as ints.

artagesw wrote:

It’s true. Plugins are essential, yes. But when you decide to use them, you must be prepared for potential problems down the road.

I just lol’d for your definition, chill out :). I know that, or then I’m been on drugs donuts for the last five years. Donuts…

Offline

#31 2009-07-06 14:58:11

alannie
Member
From: Minnesota, USA
Registered: 2005-09-15
Posts: 150

Re: Specify article_custom limit AND check for non-empty custom field?

By Jove! video_id="_%" works. jsoo, do you have any kind of blog or email notification list that I can join to be notified of your future brilliant discoveries and plugins? :)

By the way, I wouldn’t mothball your plugin just yet … I bet it could come in handy for other uses. I’ll let you know if I come across any examples beyond the ones you already have listed.

Last edited by alannie (2009-07-06 14:59:36)

Offline

#32 2009-07-06 15:39:56

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: Specify article_custom limit AND check for non-empty custom field?

alannie wrote:

By Jove! video_id="_%" works. jsoo, do you have any kind of blog or email notification list that I can join to be notified of your future brilliant discoveries and plugins? :)

My Txp brilliancy ;) shines forth rather sporadically, intermixed with a much higher percentage of blather, on this forum; very irregularly on my own Txp page, to which, for various reasons, I have not yet added a feed. I just posted a tip on Txp Tips, which does have a feed, well worth following. Might post this one as another Txp Tip, pace artagesw.

By the way, I wouldn’t mothball your plugin just yet … I bet it could come in handy for other uses. I’ll let you know if I come across any examples beyond the ones you already have listed.

Well, picked up one user pretty quickly, so I’ll keep it online for now.


Code is topiary

Offline

Board footer

Powered by FluxBB