Textpattern Forum

You are not logged in. Register | Login | Help

#1 2010-05-11 20:33:30

makss
Plugin Author
From: Ukraine
Registered: 2008-10-21
Posts: 249
Website

[request] 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

#2 2010-05-11 21:53:11

rsilletti
Moderator
From: Spokane WA
Registered: 2004-04-28
Posts: 700

Re: [request] 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

#3 2010-05-11 23:02:30

Gocom
Developer
Registered: 2006-07-14
Posts: 4,476
Website

Re: [request] 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

#4 2010-05-12 06:44:30

makss
Plugin Author
From: Ukraine
Registered: 2008-10-21
Posts: 249
Website

Re: [request] 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

#5 2010-05-12 12:44:23

wet
Developer
From: Lenzing, Austria
Registered: 2005-06-06
Posts: 3,102
Website

Re: [request] 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

#6 2010-05-12 14:03:58

makss
Plugin Author
From: Ukraine
Registered: 2008-10-21
Posts: 249
Website

Re: [request] 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

#7 2010-05-12 14:40:14

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 5,868
Website

Re: [request] 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

#8 2010-05-12 16:42:40

makss
Plugin Author
From: Ukraine
Registered: 2008-10-21
Posts: 249
Website

Re: [request] 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

#9 2012-05-22 09:06:08

makss
Plugin Author
From: Ukraine
Registered: 2008-10-21
Posts: 249
Website

Re: [request] 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

Board footer

Powered by FluxBB