Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1117 2011-12-02 07:22:03

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

Re: zem_contact_reborn 4.0.3.20

Future intentions are to develop an email template with replacement tags (like Bloke uses) so that there is more capacity yet again to customise the emails

I briefly discussed something similar a while back with Ruud when I also made some changes to zcr and passed them back to him. He had several detailed ideas of his own on this, and on my own changes – all good I hasten to add – but I don’t know how far he is with that yet.


TXP Builders – finely-crafted code, design and txp

Offline

#1118 2011-12-02 11:09:41

aslsw66
Member
From: Canberra, Australia
Registered: 2004-08-04
Posts: 342
Website

Re: zem_contact_reborn 4.0.3.20

Well, this was mainly for my own needs – if someone else is working on a neater solution than I’m happy to stand aside for the experts.

But I do want to get the bcc to function as best as possible – it is my technique to send out bulk emails to members (and our membership is quite small, only 40 or so) – and ensuring the get the emails the first time, every time is important as these are less tech-savvy than most. From looking around the web, it looks like I need to look more closely at the headers set – I think ZCR doesn’t set the full range of possibilities, and it seems that email clients and web mail target incomplete headers as an indicator for spam.

I still intend to let others have a look and play with my modifications when I’m done.

Offline

#1119 2011-12-18 16:02:15

THE BLUE DRAGON
Member
From: Israel
Registered: 2007-11-16
Posts: 615
Website

Re: zem_contact_reborn 4.0.3.20

Hi,
I want to use the to_form feature and output a dynamic list of addresses.
Now I will like to get help with the syntax please:

<txp:php>
	global $zem_contact_form;
	switch($zem_contact_form['my-select-list-label'])
	{
</txp:php>
		<txp:article_custom section="my-section-name" limit="999" sort="Posted desc">
		case '<txp:custom_field name="City" />': echo '<txp:custom_field name="Email_address" />';
		break;
		</txp:article_custom>
		default: echo 'info@example.com';
<txp:php>
	}
</txp:php>

Now I know that this is not the right syntax, but I don’t know what is please?

Offline

#1120 2011-12-18 21:34:26

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: zem_contact_reborn 4.0.3.20

THE BLUE DRAGON wrote:

Hi,
I want to use the to_form feature and output a dynamic list of addresses.
Now I will like to get help with the syntax please:

Something like this, where custom_1 is the custom field (not how you’ve labeled it!) that contains the email address and custom_2 is the custom field that contains the city.

<txp:php>
	global $zem_contact_form;
	$email = safe_field('custom_1', 'textpattern', "custom_2 = '".doSlash($zem_contact_form['my-select-list-label'])."'");
	if ($email === FALSE) $email = 'info@example.com';
	echo htmlspecialchars($email);
</txp:php>

Offline

#1121 2011-12-18 21:57:25

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: zem_contact_reborn 4.0.3.20

Or based on Ruud’s snippet, same with the help of a article_custom;

<txp:article_custom sort="custom_1 asc" limit="1" City='<txp:php> echo $GLOBALS["zem_contact_form"]["my-select-list-label"]; </txp:php>'>
	<txp:custom_field name="Email_address" default="info@example.com" />
</txp:article_custom>

Note that both, mine and Ruud’s will only return a single email address, not a list. If your idea is to return multiple addresses from multiple articles selected based on the city, and only show info@example.com as a fallback when no articles are found, you will need something bit different. Something like following:

<!--
	has_email named variable will be set "1" in the article's container,
	if addresses are found. For now we set it as "0".
-->

<txp:variable name="has_email" value="0" />

<!--
	List articles that have "Email_address" populated
	and "City" matched form's selection
-->

<txp:article_custom sort="custom_1 asc" Email_address="_%" limit="999" City='<txp:php> echo $GLOBALS["zem_contact_form"]["my-select-list-label"]; </txp:php>'>
	<txp:if_different>
		<txp:custom_field name="Email_address" default="info@example.com" />
	</txp:if_different>
	<txp:variable name="has_email" value="1" />
</txp:article_custom>

<!--
	Show fallback if no addresses were found.
-->

<txp:if_variable name="has_email" value="0">
	info@example.com
</txp:if_variable>

Please keep in mind that Textpattern doesn’t escape LIKE operators’ wildcard syntax in the custom fields’ SQL statements. If a value passed to article_custom’s custom_field attribute (custom_field="value") contains any wildcard characters (_, %), those will be treated as one and not as plain text. If any of the fields used to filter the list contains (or are populated with) any of those wildcard characters, you may get unexpected results say the least.

Last edited by Gocom (2011-12-18 22:18:02)

Offline

#1122 2011-12-19 11:12:43

THE BLUE DRAGON
Member
From: Israel
Registered: 2007-11-16
Posts: 615
Website

Re: zem_contact_reborn 4.0.3.20

Thanks Ruud and Gocom, I used Jukka second code to return multiple addresses (one from each article).
It works great, thank you very much! :)
And ohh…I wasn’t even close with the plugin help example :/

The idea was that I got a ‘showrooms’ section and a ‘contact’ page,
and in each showroom article the client enter it’s email address.
Now when a visitor choose a showroom from the select-list in the contact page form,
it will send the email to the address that the client set in that showroom’s article.
So now it’s all dynamic, I present the list of showrooms in the contact form using article-custom and now thanks to your code I set the to_form feature to be also dynamic with article-custom, so in the end the client can update showrooms and it all be done automatically.
(Besides of the default email address which is static)

Cool :)

Offline

#1123 2012-01-16 20:08:33

ajw-art
Member
Registered: 2010-02-10
Posts: 33

Re: zem_contact_reborn 4.0.3.20

I’m using ZCR to generate the contact me form on my webpage. It’s working as expected with one exception: the select field. To be specific, it’s the only field that doesn’t come through in the email that the form sends to me. Any ideas as to why this might be the case?

I did make some changes to the plugin code itself to enable support for the HTML5 placeholder attribute, but I can’t see where anything I’ve done would have disabled the select field. Here’s a link to the edited code on pastebin so you can see the changes I made. Any help would be much appreciated. Thanks!

Offline

#1124 2012-01-16 21:31:09

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: zem_contact_reborn 4.0.3.20

@ajw-art, it’s probably related to the “name” attribute value, which contains a space. Try replacing it with something without a space. This would’ve caused the same problem if you were using an unmodified ZCR ;)

Offline

#1125 2012-01-16 21:40:24

ajw-art
Member
Registered: 2010-02-10
Posts: 33

Re: zem_contact_reborn 4.0.3.20

@ruud Yup, that was it! Thanks a lot.

Offline

#1126 2012-01-19 23:27:57

robhert
Member
From: Perú
Registered: 2007-04-27
Posts: 204
Website

Re: zem_contact_reborn 4.0.3.20

Hi to all! Is this possible?

<txp:zem_contact_secret value="<txp:title />" />

So I could receive the Title of the page that was send from.

Thanks in advance!

(PS. Sorry bad English)

Offline

#1127 2012-01-20 00:38:15

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

Re: zem_contact_reborn 4.0.3.20

Try single quotes around txp:title: <txp:zem_contact_secret value='<txp:title />' />


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

Offline

#1128 2012-01-20 02:46:27

robhert
Member
From: Perú
Registered: 2007-04-27
Posts: 204
Website

Re: zem_contact_reborn 4.0.3.20

Hey @uli Thanks a lot!

Offline

Board footer

Powered by FluxBB