2010-05-11 20:33:30

makss
Plugin Author
êta
From: Ukraine
Known languages: ru, ua, en
Website

Extend txp:article_custom tag with true SQL where.

Possible it bad idea, but for me this very useful.

In this patch I add simple support for true SQL where.


aks_cron : Cron inside Textpattern | aks_article : extended article_custom tag
aks_cache : cache for TxP | aks_meta | aks_header : Compress your pages on the fly

Offline

 

2010-05-11 21:53:11

rsilletti
Moderator
nu
Real name: Rick Silletti
From: Yellowstone Ntl Park

Re: Extend txp:article_custom tag with true SQL where.

What is the thinking behind using asy_wondertag under version TXP 4.2.0, unless it handles internal characters differently than TXP’s tags within tags capability.

Your example code:

<txp:if_article_section name=“list”>
<txp:asy_wondertag><txp:article_custom form=“myform” limit=“999” where=“title like(’<txp:title />%’) and section<>‘list’” sort=“Title asc” /></txp:asy_wondertag>
</txp:if_article_section>

Offline

 

2010-05-11 23:02:30

Gocom
Developer
omega
Real name: Jukka Svahn
Website

Re: Extend txp:article_custom tag with true SQL where.

rsilletti wrote:

What is the thinking behind using asy_wondertag under version TXP 4.2.0, unless it handles internal characters differently than TXP’s tags within tags capability.

Possibly there is no real purpose behind it. With 4.0.7+ parser the exact same would be:

where='Title like(''<txp:title />%'') and Section<>''list'''

To me the idea of where in the core is really bad. As a plugin, why not — totally great idea, but in the core not so much. It opens too many injection possiblities and isn’t exactly user friendly.

Last edited by Gocom (2010-05-11 23:05:52)


Rah-plugins | What? I’m a little confused… again :-) <txp:is_god />

Offline

 

2010-05-12 06:44:30

makss
Plugin Author
êta
From: Ukraine
Known languages: ru, ua, en
Website

Re: Extend txp:article_custom tag with true SQL where.

Gocom wrote:

where='Title like(''<txp:title />%'') and Section<>''list'''

Thanks for correct code.

It opens too many injection possiblities and isn’t exactly user friendly.

You rights, it is necessary yet to do additional verification to avoid possible sql injections.

In the future, if it to plug in a core, then it is possible to do option same as

  • Allow PHP in pages?
  • Allow PHP in articles?
  • Allow raw PHP?


aks_cron : Cron inside Textpattern | aks_article : extended article_custom tag
aks_cache : cache for TxP | aks_meta | aks_header : Compress your pages on the fly

Offline

 

2010-05-12 12:44:23

wet
Developer
omega
Real name: Robert
From: Lenzing, Austria
Known languages: de-AT, en, PL/M-80
Website

Re: Extend txp:article_custom tag with true SQL where.

Strange: We use tags to abstract SQL, then we add attributes to tags to unveil a fraction of the previously abstracted SQL. I’d rather suggest to transfer this idea into the Plugin Requests forum.

Offline

 

2010-05-12 14:03:58

makss
Plugin Author
êta
From: Ukraine
Known languages: ru, ua, en
Website

Re: Extend txp:article_custom tag with true SQL where.

wet wrote:

Strange: We use tags to abstract SQL, then we add attributes to tags to unveil a fraction of the previously abstracted SQL.

It’s two ways and they can complement each other. IMHO, 95% queries can decide abstract SQL, but other 5% deciding through abstract SQL is impossible.


aks_cron : Cron inside Textpattern | aks_article : extended article_custom tag
aks_cache : cache for TxP | aks_meta | aks_header : Compress your pages on the fly

Offline

 

2010-05-12 14:40:14

Bloke
Developer
omega
Real name: Stef Dawson
From: Leeds, UK
Known languages: Engl(ish)
Website

Re: Extend txp:article_custom tag with true SQL where.

makss wrote:

IMHO, 95% queries can decide abstract SQL

… and for everything else there’s smd_query, which has the advantage of being able to paginate articles, unlike article_custom ;-)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern.

Txp Builders – finely-crafted code, design and Txp

Offline

 

2010-05-12 16:42:40

makss
Plugin Author
êta
From: Ukraine
Known languages: ru, ua, en
Website

Re: Extend txp:article_custom tag with true SQL where.

Bloke wrote:

IMHO, 95% queries can decide abstract SQL

… and for everything else there’s smd_query, which has the advantage of being able to paginate articles, unlike article_custom ;-)

smd_query – great plugin! Thank you for its creation.
I use smd_query for implementation of difficult sql queries with “group by”, “union”, “subquery” and “free queries to external tables”, but for other very simple queries to article I use patched article_custom.

article_custom uses standart TxP form, for example, the same forms I use from other plugins(rss_unlimited_categories, aks_rss).

Some features which it is difficult to decide with smd_query (it’s only my IMHO)

  • Not support standart TxP form (possibly, it quite and it is not needed for smd_query)
  • There is not support of prefixes to the tables of TXP (or I did not find how to use this possibility)

Other ideas on plugin smd_query I will describe in the forum of its support. Thank you once again for good plugin.


aks_cron : Cron inside Textpattern | aks_article : extended article_custom tag
aks_cache : cache for TxP | aks_meta | aks_header : Compress your pages on the fly

Offline

 

2012-05-22 09:06:08

makss
Plugin Author
êta
From: Ukraine
Known languages: ru, ua, en
Website

Re: Extend txp:article_custom tag with true SQL where.

Two years passed… Welcome to aks_article plugin :)

Last edited by makss (2012-05-22 10:35:03)


aks_cron : Cron inside Textpattern | aks_article : extended article_custom tag
aks_cache : cache for TxP | aks_meta | aks_header : Compress your pages on the fly

Offline

 

Powered by FluxBB