Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#37 2012-03-26 19:20:09

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 999
Website

Re: smd_each: iterate over stuff

After posting this, I realized that the multiselect field won’t meet my needs, since you can’t control the order in which authors will be listed— that’s kind of important for academic content. While I’m curious about a solution to this for future struggles, please don’t divert your attention from more important endeavors!

Offline

#38 2012-03-26 19:55:19

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,577
Website

Re: smd_each: iterate over stuff

I realized that the multiselect field won’t meet my needs, since you can’t control the order

John, bsmSelect may interest you then. Take a look at the sortable examples.


TXP Builders – finely-crafted code, design and txp

Offline

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

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,243
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

#40 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

#41 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