Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#31 2007-10-16 18:01:29
- Logoleptic
- Plugin Author

- From: Kansas, USA
- Registered: 2004-02-29
- Posts: 482
Re: zem_contact_reborn 4.0.3.20
@uncalau: Though you’ve solved the problem using the “redirect” attribute, there’s a quick way to figure out if any future problems are caused by over-aggressive caching. You can re-load a page entirely from the server (bypassing your browser cache) by pressing Ctrl + F5. This works in all major browsers.
Edit: The keyboard shortcut may be different on a Mac.
Last edited by Logoleptic (2007-10-16 18:02:25)
Offline
#32 2007-10-19 21:10:29
- novatron6
- Member
- Registered: 2006-10-15
- Posts: 11
Re: zem_contact_reborn 4.0.3.20
Hello,
I was wondering if there was a way to use the “User selectable recipient, without showing email address” feature from a link, meaning on a page a user clicks on “EMAIL DOUG” or “EMAIL SARAH” and it takes them to the contact form with the specified recipient already selected. Does that make sense?
Any help would be appreciated, thanks!
Offline
#33 2007-10-19 22:31:12
- Logoleptic
- Plugin Author

- From: Kansas, USA
- Registered: 2004-02-29
- Posts: 482
Re: zem_contact_reborn 4.0.3.20
novatron6 wrote:
I was wondering if there was a way to use the “User selectable recipient, without showing email address” feature from a link, meaning on a page a user clicks on “EMAIL DOUG” or “EMAIL SARAH” and it takes them to the contact form with the specified recipient already selected. Does that make sense?
You could do this by using GET variables (also known as URL variables). This is a way of passing data other than a page reference in a URL, so that the page at that URL can act on the data somehow.
You can see GET variables in action when you use Google. If you search for information about Textpattern and set your preferences to return 100 results per page, the URL of the results page might look something like this (look after the “?”): http://www.google.com/search?num=100&q=textpattern
In your case, the links to your contact page could contain a “to” variable. For instance: http://www.example.com/contact?to=doug
Making sure that the right person gets the message involves some PHP mixed in with your contact form code. I think this will work, depending on how Textpattern parses the <txp:php> tags (can anyone confirm?):
<txp:php>
if ( isset( $_GET['to'] ) ) {
switch( $_GET['to'] ) {
case 'doug':
</txp:php>
<txp:zem_contact_select label="Department" list=",Doug,Sarah" selected="Doug" />
<txp:php>
break;
case 'sarah':
</txp:php>
<txp:zem_contact_select label="Department" list=",Doug,Sarah" selected="Sarah" />
<txp:php>
break;
default:
</txp:php>
<txp:zem_contact_select label="Department" list=",Doug,Sarah" />
<txp:php>
}
} else {
</txp:php>
<txp:zem_contact_select label="Department" list=",Doug,Sarah" />
<txp:php>
}
</txp:php>
If you’re not comfortable with PHP, there’s another way to do it by combining a few plugins. Let me know.
Last edited by Logoleptic (2007-10-21 18:58:37)
Offline
Re: zem_contact_reborn 4.0.3.20
I think this plug-in will be helpful: chs_if_urlvar
Offline
#35 2007-10-20 05:04:47
- novatron6
- Member
- Registered: 2006-10-15
- Posts: 11
Re: zem_contact_reborn 4.0.3.20
Thanks Logoleptic and maniqui,
I think this will help, not too familiar with PHP but have worked with it a little, I will let you know if I get it to work, thanks!
doug
Offline
#36 2007-10-21 10:26:04
- Logoleptic
- Plugin Author

- From: Kansas, USA
- Registered: 2004-02-29
- Posts: 482
Re: zem_contact_reborn 4.0.3.20
I think this plug-in will be helpful: chs_if_urlvar
Yeah, that’s one of the plugins I had in mind. You could combine it with asy_wondertag to use the value of the to GET variable as the value of the selected attribute for <txp:zem_contact_select />:
<txp:chs_urlvar_exists var="to">
<txp:asy_wtag><txp:zem_contact_select label="Department" list=",Doug,Sarah" selected="<txp:chs_urlvar_echo var="to" />" /></txp:asy_wtag>
</txp:chs_urlvar_exists>
I’m not sure what ZCR would do if to had a value that didn’t match any of the options in the tag’s list attribute (e.g. ?to=bob). If this produces an error message even when the site’s production status is set to “Live,” you might be able to compensate using chh_if_data (chs_if_urlvar doesn’t support <txp:else /> to handle these exceptions itself). Using chh_if_data this way would be more complicated and less flexible than the example I’ve given above, so it probably isn’t worth it unless other people will have the ability to create and edit these “Email [Somebody]” links.
One caveat about chs_if_urlvar: I’ve had problems with it producing a ton of error messages when a site’s production status is set to “Testing” or “Debugging.” it works just fine, but the top of the page ends up full of debugging code. I’ve e-mailed the author about this, but gotten no response. If you’re doing any experimental work that might require changing the production status, I’d recommend doing it on localhost or some other testing-only environment.
Offline
Re: zem_contact_reborn 4.0.3.20
I’d do it like this:
<txp:php>
echo zem_contact_select(array(
'label' => 'Department',
'list' => ',Doug,Sarah',
'selected' => ucfirst(gps('to'))
));
</txp:php>
Offline
#38 2007-10-21 18:54:17
- Logoleptic
- Plugin Author

- From: Kansas, USA
- Registered: 2004-02-29
- Posts: 482
Re: zem_contact_reborn 4.0.3.20
ruud wrote:
I’d do it like this:
Ooh, I wasn’t aware of the built-in gps() function. Its buddy gpsa() also looks interesting. I’ve been considering “adopting” chs_if_urlvar and doing rewrites, and these would come in handy.
What’s the etiquette for plugin adoption, by the way? I hope that’s not too off-topic for this thread, but considering ZCR’s origins and history it seems like a good place to ask.
Offline
Re: zem_contact_reborn 4.0.3.20
Ask the original author (or current maintainer) of the plugin first, I suppose.
Offline
#40 2007-10-21 23:08:19
- Logoleptic
- Plugin Author

- From: Kansas, USA
- Registered: 2004-02-29
- Posts: 482
Re: zem_contact_reborn 4.0.3.20
ruud wrote:
Ask the original author (or current maintainer) of the plugin first, I suppose.
Tried it, but I’ll try again. Thanks for the tip. :-)
Offline
#41 2007-10-22 14:24:37
- novatron6
- Member
- Registered: 2006-10-15
- Posts: 11
Re: zem_contact_reborn 4.0.3.20
ruud wrote:
I’d do it like this:
<txp:php>
echo zem_contact_select(array(
'label' => 'Department',
'list' => ',Doug,Sarah',
'selected' => ucfirst(gps('to'))
));
</txp:php>
Thanks alot, this works awesome!
doug
Last edited by novatron6 (2007-10-22 14:25:00)
Offline
#42 2007-10-31 21:49:17
- sazan1978
- New Member
- Registered: 2007-10-31
- Posts: 2
Re: zem_contact_reborn 4.0.3.20
Is there any way to set a type=“hidden” for a field? It doesn’t seem to be an attribute of zem_contact_text or other tags…
I tried adding html code inside the <txp:zem_contact>:
<input type=“hidden” name=“code” value=“some_code” />it shows up in page source, but it not included in the results that are emailed.
Offline
#43 2007-11-01 01:08:04
- Logoleptic
- Plugin Author

- From: Kansas, USA
- Registered: 2004-02-29
- Posts: 482
Re: zem_contact_reborn 4.0.3.20
sazan1978 wrote:
Is there any way to set a type=“hidden” for a field?
It would help to know what you’re trying to accomplish by including a hidden field. Even if the option doesn’t exist in this version of ZCR (I haven’t yet checked), someone might be able to suggest an alternate approach.
Offline
Re: zem_contact_reborn 4.0.3.20
I think the txp:zem_contact_secret tag in ZCR performs the function you are looking for. Read the plugin help, or do a search of this thread and you should find more information.
Offline
#45 2007-11-01 09:53:34
- Logoleptic
- Plugin Author

- From: Kansas, USA
- Registered: 2004-02-29
- Posts: 482
Re: zem_contact_reborn 4.0.3.20
The zem_contact_secret tag won’t work for sazan, because the contents of the tag show up in the e-mail message.
I just checked the documentation and can’t find any mention of a way to create hidden fields (at least, nothing turns up when I search the help page for ‘hid’).
Offline