Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#37 2012-03-26 21:31:19

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

Re: smd_each: iterate over stuff

johnstephens wrote:

Setting delim, outdelim, or paradelim to | doesn’t help

Unfortunately no, cf. the comment above to the blue dragon. The plugin is pretty stupid and it really needs a make-over. If you solve the order thing and need the plugin for your site, let me know and I’ll divert some time to it.


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

#38 2012-03-26 23:31:27

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

Re: smd_each: iterate over stuff

johnstephens wrote

However, the required subset=“2” setting only takes commas as a delimiter. Is that right?

In my experience, subset="2" always required colon (:) as separator, when using type="fixed" (don’t recall trying with other types).
For example:

<txp:smd_each type="fixed" include="my_categories:music:film:games:arts:literature" subset="2">...</txp:smd_each>

where my_categories is just the variable name and music, film, games, etc, are each of the values smd_each iterates over.
It always looked a bit odd to me to use the same separator (the colon) between the variable name and the list of values, and between the values themselves. Not complaining, just an observation!


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#39 2013-04-16 15:27:38

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

Re: smd_each: iterate over stuff

Smd Each Challenge I can’t quite get sorted.

I have two variables which are each lists (prices and sizes).

  • prices=”$3,$8,$2,$6”
  • sizes=“glass,pitcher,glass(happy hour)|pitcher(happy hour)”

I want to output this:

<p>$3 bottle | $8 pitcher</p>
<p>$2 bottle(happy hour) | $6 pitcher(happy hour)</p>

What I really need to do is make a new variable which is an alternating list of prices and sizes. Any ideas?

Offline

Board footer

Powered by FluxBB