Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-03-25 00:30:05

molly
Member
From: Virginia
Registered: 2004-08-15
Posts: 44
Website

Comma delimited list to formatted list

How difficult would it be to create a plugin that would take this from a custom field:

brown,black,red,blue

And render it thusly:
<code>
<option value=“brown”> brown </option>
<option value=“black”> black </option>
<option value=“red”> red </option>
<option value=“blue”> blue </option>
</code>

This is the only thing stopping me from building a simple e-commerce site using Paypal.

It seems like it would be pretty simple for someone who knows PHP. But maybe not, I really don’t know.

TIA,
Molly

Offline

#2 2006-03-25 05:51:15

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: Comma delimited list to formatted list

Not difficult at all, anyone with basic PHP knowledge.

Offline

#3 2006-03-25 14:33:50

molly
Member
From: Virginia
Registered: 2004-08-15
Posts: 44
Website

Re: Comma delimited list to formatted list

Thanks Mary!

To anyone who’s interested: I don’t have enough php knowledge to do this myself, but I do have 50 bucks burning a hole in my Paypal account for anyone who would take the time to create this simple plugin. Either directly to you, or a donation to txp on your behalf.

Offline

#4 2006-03-26 00:43:41

whatbrick
Member
From: Texas
Registered: 2006-03-13
Posts: 100

Re: Comma delimited list to formatted list

See if this (<a href=“http://www.theguruguys.com/file_download/1” title=“wb_fieldtoform-0.1.txt”>wb_fieldtoform-0.1.txt</a>) does what you want. It was quick, and it’s messy, but it seemed to work ok for me.

This:

<txp:wb_fieldtoform name="custom1" formname="weird" />

Would give you this:

<select name="weird">
	<option value="">Select One</option>
	<option value="blue">blue</option>
	<option value="black">black</option>
	<option value="cookie-monster">cookie-monster</option>
	<option value="bigBird">bigBird</option>
	<option value="wallace">wallace</option>
	<option value="gromit">gromit</option>
	<option value="sugar">sugar</option>
	<option value="guns">guns</option>
</select>

If you had this:

blue,black,cookie-monster,bigBird,wallace,gromit,sugar,guns

in the “custom1” field

There are other options as well that are listed in the plugin help screen. Keep in mind, I’m a markup-monkey, not a programmer. :)


Do not taunt the Markup Monkey!

Offline

#5 2006-03-27 14:13:57

molly
Member
From: Virginia
Registered: 2004-08-15
Posts: 44
Website

Re: Comma delimited list to formatted list

Thanks, Whatbrick! I am in awe of your markup-monkey skills.

Offline

Board footer

Powered by FluxBB