Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2008-05-14 20:19:50
- rheroux
- New Member
- Registered: 2008-03-24
- Posts: 5
Textpattern Tags inside of <txp:php> tags?
I have a simple “if form is submitted email it out, otherwise display the form” static page that I’m trying to code up in TXP. (Yes, I know about zem_contact_reborn but it’s doesn’t do everything I need, so I’m trying to use phpMailer.)
However, it seems that TextPattern does not like any textpattern tags (i.e. <txp:output_form form=“header”>)within <txp:php> </txp:php> tags…
Simple question, how do I properly code the following?
<txp:php>
if($_POST['sndEmail']) {
require("class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = "myrelay";
$mail->From = "formmailer@mydomain.com";
$mail->FromName = "MyDomain Form Mailer";
$mail->AddAddress("user@mydomain.com", "User");
$mail->WordWrap = 80;
$mail->IsHTML(true);
$mail->Subject = "New Interest In MyCompany From " . $_POST['txtFullName'];
$mail->Body = "<strong>Name</strong>: " . $_POST['txtFullName'] . "<br />" .
"<strong>Email</strong>: " . $_POST['txtEmail'] . "<br />" .
"<strong>Comments</strong>: " . $_POST['txtComments'] . "<br />";
$mail->AltBody = "Name:\t" . $_POST['txtFullName'] . "\n" .
"Email:\t" . $_POST['txtEmail'] . "\n" .
"Comments:\t" . $_POST['txtComments'];
$mail->Send();
echo <<<EOT
<txp:output_form form="header" />
<txp:output_form form="nav" />
<h1>Contact Us</h1>
<p>Thank you for your interest in MyCompany! We will get back to you very soon.</p>
<txp:output_form form="footer" />
EOT;
}
</txp:php>
<txp:php>
else {
echo <<<EOT
<txp:output_form form="header" />
<txp:output_form form="nav" />
<h1>Contact Us</h1>
<p>Please use the form below to contact us and share any comments and/or questions you have for us. We will get back to you ASAP.</p>
<form class="contact_form" name="contact_form" method="post" action="/contact">
<label for="txtFullName">Name:
<input class="formfield" name="txtFullName" type="text" id="txtFirstName" />
</label>
<label for="txtEmail">E-Mail Address:
<input class="formfield" name="txtEmail" type="text" id="txtEmail" />
</label>
<label for="txtEmail">Comments:
<textarea cols="40" rows="6" class="formfield" name="txtComments" id="txtComments"></textarea>
</label>
<input name="sndEmail" type="submit" id="sndEmail" value="Send" />
</form>
<div class="clear"></div>
<txp:output_form form="footer" />
EOT;
}
</txp:php>
Any help is appreciated!
Offline
Re: Textpattern Tags inside of <txp:php> tags?
ZCR does everything your code block does:
<txp:zem_contact thanks_form="thanks" to="recipient@example.com">
<txp:zem_contact_email />
<txp:zem_contact_text label="Phone" min=7 max=15/>
<txp:zem_contact_textarea label="Your question" />
<txp:zem_contact_submit label="Send" />
</txp:zem_contact>
Check the plugin help for all the tags and attributes.
Last edited by jm (2008-05-14 20:32:11)
Offline
#3 2008-05-14 20:47:36
- rheroux
- New Member
- Registered: 2008-03-24
- Posts: 5
Re: Textpattern Tags inside of <txp:php> tags?
Thanks.
I figured it out what I was doing wrong! Just had to contain everything within one <txp:php> </txp:php> block. I was splitting it up into two blocks.
Offline