Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#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

#34 2007-10-19 22:48:40

maniqui
Moderator
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: zem_contact_reborn 4.0.3.20

I think this plug-in will be helpful: chs_if_urlvar


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

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

#37 2007-10-21 11:42:46

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

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

#39 2007-10-21 19:30:46

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

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

Board footer

Powered by FluxBB