How to make a substitute for newsletter?
8 posts by 3 authors in: Forums > CMS Builder
Last Post: February 19, 2010 (RSS)
By esteban - February 15, 2010
I know only that i have to buy CSV Export Plugin :-)
Thanks
Re: [esteban] How to make a substitute for newsletter?
By Chris - February 16, 2010
I would do this by creating a "Subscribers" section with the Section Editor and adding an "Email" field to it, then use the CSV Export Plugin to get a list of subscribers.
Does that help? If not, please describe exactly what it is you're trying to achieve. Please let me know if you have any questions.
Chris
Re: [chris] How to make a substitute for newsletter?
By esteban - February 16, 2010
Re: [esteban] How to make a substitute for newsletter?
By Donna - February 17, 2010
That actually more up to you -- we don't design your page, or the way you want your site to work for you... we just come up with ways to make it work the way you want it to. :) Give us a bit more of an idea of what you're looking for, and we can help you come up with ways to create it. :)
--
support@interactivetools.com
Re: [Donna] How to make a substitute for newsletter?
By esteban - February 17, 2010
Needs by using this form http://goo.gl/6yHG to allow users to add emails to the database CMSB. I created in CMSB new section "newsletter" [ menu type: multi record ] and field e-mail [type text field].
User input their e-mail in form then click submit, e-mail is saved to CMSB section "newsletter", Editor can export list of e-mail to csv by plugin "CSV Export". How to do this? :-)
Thanks
Re: [esteban] How to make a substitute for newsletter?
By Chris - February 18, 2010
Let's break this down into two problems: (1) having a form which adds records to your "newsletter" section, and (2) CSV export.
1. Write up a form similar to this:
<?php
require_once "/your/path/to/viewer_functions.php";
if (@$_REQUEST['email']) {
mysqlStrictMode(false); // disable Mysql strict errors for when a field isn't defined below (can be caused when fields are added later)
mysql_query("INSERT INTO `{$TABLE_PREFIX}newsletter` SET
email = '" . mysql_escape(@$_REQUEST['email']) . "',
createdDate = NOW(),
updatedDate = NOW()")
or die("MySQL Error:<br/>\n". htmlspecialchars(mysql_error()) . "\n");
print "Thanks!";
exit;
}
?>
<form method="post" action="?">
<input name="email" />
<input type="submit" value="Subscribe">
</form>
2. Get the [url http://www.interactivetools.com/add-ons/detail.php?CSV-Export-1005]CSV Export Plugin[/url]
I hope this helps! Please let me know if you have any questions.
Chris
Re: [chris] How to make a substitute for newsletter?
By esteban - February 18, 2010 - edited: February 18, 2010
Csv file, however, gets all the data from the Newsletter section such as: num, createdDate, createdByUserNum, updatedDate, updatedByUserNum, dragSortOrder. Csv getting large amounts of garbage that is not structured to - in one line. Only needs to export to CSV file e-mail addresses. My client will be copied from this file, e-mail and copied to the program.
Can I remove these fields from the database? Is there another way to not export these fields in the csv file.
And one more thing. I locked the addition of the same results even though it can be added for the second time the same e-mail. -> i setup: "user may not enter the same value as another record".
and ... i test this and will be better to make after subscribe go to Thanks page [thnx.php] than print word: "Thanks!". How to do this? :-)
Thanks a lot for help.
Re: [esteban] How to make a substitute for newsletter?
By Chris - February 19, 2010 - edited: February 19, 2010
Yes, you can remove all the fields you don't need via the section editor. If you need the CSV customized further, we can help through our consulting service. Please let me know if you're interested in that.
To redirect your user to another page, replace:
print "Thanks!";
with:
header("Location: thnx.php");
Finally, the "user may not enter the same value as another record" option only works for adding and editing records inside the CMS Builder admin. To make sure no duplicate email addresses are added, you can add a check for them like this (new code in red):
if (@$_REQUEST['email']) {
if (mysql_select_count_from('newsletter', "email = '" . mysql_escape(@$_REQUEST['email']) . "'") > 0) {
mysqlStrictMode(false); // disable Mysql strict errors for when a field isn't defined below (can be caused when fields are added later)
mysql_query("INSERT INTO `{$TABLE_PREFIX}newsletter` SET
email = '" . mysql_escape(@$_REQUEST['email']) . "',
createdDate = NOW(),
updatedDate = NOW()")
or die("MySQL Error:<br/>\n". htmlspecialchars(mysql_error()) . "\n");
}
...
I hope this helps! Please let me know if you have any questions.
Chris