Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2005-06-09 21:00:54
- brian.zerangue
- Member
- Registered: 2005-02-15
- Posts: 62
zem_contact, how do i customize the e-mail message output
I have one small question, I would like to edit the e-mail message output. Please forgive me, I’m a newbie to PHP and Textpattern.
—————————————————————————-
Here’s my code…
<pre>
<txp:zem_contact mailto=“emailaddress@email.com”>
<p><txp:zem_contact_text label=“Name” required=1 /></p>
<p><txp:zem_contact_text label=“Address” required=1 /></p>
<p><txp:zem_contact_text label=“City” required=1 /></p>
<p><txp:zem_contact_text label=“Zip” required=1 /></p>
<p><txp:zem_contact_text label=“Home Phone” required=1 /></p>
<p><txp:zem_contact_text label=“Other Phone” /></p>
<p><txp:zem_contact_email /></p>
<p><txp:zem_contact_checkbox label=“I will be a group discussion leader” /></p>
<p><txp:zem_contact_checkbox label=“I already have a group (total of 6 people including myself) and “ /><br /><txp:zem_contact_textarea label=“and here are their names…” /></p>
<p><txp:zem_contact_checkbox label=“I would like to be placed in a group.” /></p>
<p> </p>
<hr />
<p><strong>Will you help us with:</strong></p>
<p><txp:zem_contact_checkbox label=“Greeting and making people feel welcome?” /></p>
<p><txp:zem_contact_checkbox label=“Audio (training will be provided)?” /></p>
<p><txp:zem_contact_checkbox label=“Video (training will be provided)?” /></p>
<p> </p>
<p><txp:zem_contact_submit label=“Register now” /></p>
<p> </p>
</txp:zem_contact>
</pre>
—————————————————————————-
Here’s the output that I get…
Name: John Doe
Address: 123 Test Ave.
City: Test Form Town
Zip: 90210
Home Phone: 213-555-0000
Other Phone: 213-555-0001
Email: john.doe@fakeaddress.com
I will be a group discussion leader: Yes I already have a group (total of 6 people including myself) and : Yes and here are their names…: Bob, Sue, Ralph, Jane, Hal I would like to be placed in a group.: Yes Greeting and making people feel welcome?: Yes Audio (training will be provided)?: Yes Video (training will be provided)?: Yes
—————————————————————————-
This is the output that I want…
Name:
John Doe
Address:
123 Test Ave.
City:
Test Form Town
Zip:
90210
Home Phone:
213-555-0000
Other Phone:
213-555-0001
Email:
john.doe@fakeaddress.com
I will be a group discussion leader:
Yes
I already have a group (total of 6 people including myself) and :
Yes
and here are their names…:
Bob, Sue, Ralph, Jane, Hal
I would like to be placed in a group.: Yes
Greeting and making people feel welcome?:
Yes
Audio (training will be provided)?:
Yes
Video (training will be provided)?:
Yes
—————————————————————————-
CAN ANYONE HELP ME WITH THIS?
Offline
Re: zem_contact, how do i customize the e-mail message output
Yes, you can do that but you have to edit the plug-in code.
Edit the plug-in source and look for the following code around line 61 in function zem_contact:
<code> $msg .= “$k: “.htmlspecialchars($v).”\n”; </code>
add some line break characters to the output as follows:
<code> $msg .= “$k: \n”.htmlspecialchars($v).”\n\n”; </code>
If you need to add other infos to help structure the email output i.e. similar to fieldset headers use zem_contact_hidden and a dummy value and it will be written into the mail.
TXP Builders – finely-crafted code, design and txp
Offline
#3 2005-06-11 19:46:42
- brian.zerangue
- Member
- Registered: 2005-02-15
- Posts: 62
Re: zem_contact, how do i customize the e-mail message output
Jakob -
Thank you so much! That worked perfect!
Offline
Re: zem_contact, how do i customize the e-mail message output
Another small thing:
would it be possible to have the contents of an input field (i.e. the subject) display as the actual subject of the email, perhaps with a prefix such as [mailform]?
Offline
Re: zem_contact, how do i customize the e-mail message output
And what about using a custom field? I can’t find a way to insert <txp:custom_field name="myfield" />
to display it as the subject or add it to the message body.
Last edited by kees-b (2005-06-12 07:15:07)
Offline
#6 2005-11-26 00:48:22
- Th0maz
- New Member
- From: The Netherlands
- Registered: 2005-11-22
- Posts: 2
Re: zem_contact, how do i customize the e-mail message output
Is it also possible to go even further than brian.zerangue’s idea and wrap the output in a table?
Am i able to input the normal table code and than wrap all inputs in tr’s and td’s?
Thanks in advance!
Offline