Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-12-17 02:31:32

squaredeye
Member
From: Greenville, SC
Registered: 2005-07-31
Posts: 1,495
Website

escaping parentheses?

I will be trying to use the following code with zem_contact_reborn and wondered if I’ve got my php correct?
Can anyone let me know if I need to escape my parentheses?

<code>
<txp:php> global $zem_contact_form; switch($zem_contact_form[‘Deliver To’]) { case ‘AnnMarie Schultz (Admin)’: echo ‘blah@gmail.com’; break; case ‘Geoff Bradford (Lead Pastor)’: echo ‘blah@gmail.com’; break; case ‘Joe’: echo ‘blah@gmail.com’; break; default: echo ‘blahandpoop@gmail.com’; }
</txp:php>
</code>


Offline

#2 2006-12-17 03:06:38

Walker
Plugin Author
From: Boston, MA
Registered: 2004-02-24
Posts: 592
Website

Re: escaping parentheses?

You shouldn’t need to escape those parentheses. Looks….kinda right to me…..I don’t know where $zem_contact_form['Deliver To'] is coming from, but it looks right.

Offline

#3 2006-12-17 12:27:51

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

Re: escaping parentheses?

zem_contact_form is a global variable that comes from the zem_contact_reborn plugin. Only if you wanted to use single quotes in that string they’d have to be escaped (by adding a backslash in front of it). Anything else is okay.

Offline

#4 2006-12-17 14:31:32

Walker
Plugin Author
From: Boston, MA
Registered: 2004-02-24
Posts: 592
Website

Re: escaping parentheses?

Only if you wanted to use single quotes in that string they’d have to be escaped (by adding a backslash in front of it). Anything else is okay.

I think ruud is saying that your code is okay right now, but that if you wanted to use single quotes in any of the strings you’d have to escape it, which agree with my analyzation.

I knew where zem_contact_form was coming from on the global, but now I realise I know where the [‘Deliver To’] array var is coming from. It was a property you set in the txp:zem_contact_reborn tag, wasn’t it?

Offline

#5 2006-12-17 15:55:35

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

Re: escaping parentheses?

^^ exactly, that’s what I meant.

The ‘Deliver To’ is probably the label attribute of a zem_contact_select tag, so visitors can select who they want to send the email to when using the zem_contact_reborn form.

Offline

Board footer

Powered by FluxBB