Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#25 2008-06-11 13:47:26

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

Re: Semi-persistent general storage plugin

lee wrote:

I’m in Cov next month (I think) if you fancy a meetup/beer let me know.

Sweet. Sounds like a plan to me. When you know for sure, drop me a line. I’m away quite a bit next month myself but with luck there’ll be some overlap.


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

#26 2008-06-11 15:04:00

mrdale
Member
From: Walla Walla
Registered: 2004-11-19
Posts: 2,215
Website

Re: Semi-persistent general storage plugin

Bloke: Just trying to wrap my brain around uses for this plugin…

Could I use this plugin to solve the following scenario. I want to allow selection of articles from a list of article titles via checkbox, to display full articles after the form is posted?

Offline

#27 2008-06-11 15:47:32

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

Re: Semi-persistent general storage plugin

mrdale> yes, but it’s probably overkill in this case because you’d have to know how many variables to read from the form results, then store them all and retrieve them straight away.

What you need is the (in development) companion smd_each tag. If I can iron out the functionality, that will iterate over pretty much anything you can get your mitts on, either from smd_vars or from the URL line (or a TXP field) and chuck the items at a form so you can do what you damn well like with them. The variables that get passed to the form (or containing doohicky) can be filtered by name or value or both. They can even be collated and quoted (like images in smd_gallery) so you can make up lists. I believe a lot of tags now (or will soon) accept lists of IDs, so that is probably what you’ll want to do. You can collate all the matching variables into a comma-separated list and then in your foreach form you can put an article_custom id="{value}" and that’ll plug in all the checked articles.

The limits are virtually limitless. You could store or append each matching thing to an smd_var, or put them in a txp:variable. You could filter them further using smd_if then perhaps build a query to throw at smd_query or plug each value into an SQL stub in an smd_var.

I’m sure you can a) find completely radical uses for this, or b) break it :-p

Watch this space.


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

#28 2008-06-11 16:31:33

net-carver
Archived Plugin Author
Registered: 2006-03-08
Posts: 1,648

Re: Semi-persistent general storage plugin

Bloke wrote:

The limits are virtually limitless.

Wow — ROFL Stef! Limitless limits. What routine could you possibly write to top that?

Seriously though, smd_each sounds like a neat tag.


Steve

Offline

#29 2008-06-11 16:45:41

mrdale
Member
From: Walla Walla
Registered: 2004-11-19
Posts: 2,215
Website

Re: Semi-persistent general storage plugin

Stef ‘n Steve> Ah… yeah, like… I watched the space and nothing happened…

LOL. seriously great news. I’m not sure, but one of these days my smd/sed/etc plugin code will overtake my txp installs in size…

Last edited by mrdale (2008-06-11 16:53:45)

Offline

#30 2008-06-11 23:39:37

lee
Member
From: Normandy, France
Registered: 2004-06-17
Posts: 831

Re: Semi-persistent general storage plugin

Stef, how can I put the current article id into smd_var_put value=”“

Cheers
Lee

Offline

#31 2008-06-11 23:42:48

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

Re: Semi-persistent general storage plugin

lee wrote:

Stef, how can I put the current article id into smd_var_put value=”“

Use <txp:smd_var_put name="this_article" value="?id" />


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

#32 2008-06-11 23:54:58

lee
Member
From: Normandy, France
Registered: 2004-06-17
Posts: 831

Re: Semi-persistent general storage plugin

Thanks.

Offline

#33 2008-06-12 00:34:28

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: Semi-persistent general storage plugin

Bloke wrote:

You can collate all the matching variables into a comma-separated list and then in your foreach form you can put an article_custom id="{value}" and that’ll plug in all the checked articles.

Just to refine this example: you will be able to pass your comma-separated list as a value for article_custom: r2888


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#34 2008-06-12 09:55:06

lee
Member
From: Normandy, France
Registered: 2004-06-17
Posts: 831

Re: Semi-persistent general storage plugin

Still struggling with the syntax, I’m using <txp:article_custom form=“property_at_a_glance” id=”<txp:smd_var_get name=“id”/>” /> but it’s returning all articles. If I replace <txp:smd_var_get name=“id”/> with the id with a number it works.

What am I missing?

Thank you
Lee

Offline

#35 2008-06-12 10:20:07

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

Re: Semi-persistent general storage plugin

lee, does perhaps name="this_article" work? (in case you used Stef’s example in #31)


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

Offline

#36 2008-06-12 10:33:29

lee
Member
From: Normandy, France
Registered: 2004-06-17
Posts: 831

Re: Semi-persistent general storage plugin

Good thinking but that’s not it.

Offline

Board footer

Powered by FluxBB