Email

Publishing email lists on a site is not a good idea because they might (read will) be used by spambots. But since private sites are protected from that, you can use the described technique to make your own email list using data forms.

What you need:

  1. a create button or link
  2. a category to save your list info (email, name, address…)
  3. a _template for that category
  4. a summary list page wich displays all your info (it will be at the bottom of this page)
  5. autonumbering for your category turned on

1) Create button

I want to have a list of emails, and all the rest should be background in my opinion. So I don't want to navigate away from the list and create a line of data and then come back to the list and so on…
Therefore I use a link to create a new line of data. The module "newpage" does not allow the system to jump back to the list after you are finished entering your data.
The link is as simple as this [ADD AN EMAIL]

[[http://yourdomein.wikidot.com/email-form:new-email/edit/true/noredirect/true ADD AN EMAIL]]

Breaking this appart:
  • yourdomein.wikidot.com = your site (replace yourdomein with the name of your site)
  • email-form:= the category name we will choose later.
  • new-email = is just a name, unimportant because we will set this category to autonumbering later
  • /edit/true = will open the editor automatically
  • /noredirect/true = will prevent that you will be redirected. More info later.
  • ADD AN EMAIL = text you'll see to click on.

This is a textlink, but if you use this URL you can also create an image(button) with that link.

2) Category

This is the name of a group of pages. If you create a template in a category, all the pages of that category will look like the template. You can not really create a category, but if you create a page in a non existing category, that category will be made on the fly. So you can just pick a name for your category and add :_template
So in this tutorial I will type http://a-simple-play.wikidot.com/email-form:_template to create both the _template and the category. Click "create page" to actualy create the _template and category.

3) _Template

If you did what is mentioned above you have a page named email-form:_template. Save this page without entering some content. Now at the bottom use the "tags" option button to enter a tag for this page. Add a tag named "_noredirect" and save the tags. Now edit the page and paste the following code in there.

[!-- --------------------------------------------------- CSS BLOCK --]
[[module css]]
#action-area h1 
     {display:none;}
#edit-page-form tbody tr:first-child 
     {display:none;}
.error-block 
     {display:none;}
#edit-cancel-button 
     {display:none;}
[[/module]]

[!-- ---------------------------------------------- REDIRECT BLOCK --]
[[iftags -_noredirect]]
[[module redirect destination="email"]]
[[/iftags]]

[!-- --------------------- INFO SHOWN WHEN REDIRECT IS DISABLED --]
This page holds the following information:
||~ Fieldname||~ Value||
||%%form_label{name}%%||%%form_data{name}%%||
||%%form_label{domein}%%||%%form_data{domein}%%||
||%%form_label{link}%%||%%form_data{link}%%||
You can delete this page by clicking "+options" and then "delete".
Otherwise just navigate away from this page

====
[[form]]
fields:
 name:
  label: email
  type: text
  hint: "John.smith"
  width: 20
  match: ";^([A-Za-z._]*)$;"
  match-error: Please only use characters that are allowed (A-Z)(a-z)(0-9) _ .
 domein:
  label: @
  type: text
  hint: "hotmail.com"
  width: 20
  join: true
  match: ";^[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)+$;"
  match-error: Please only use characters that are allowed (A-Z)(a-z)(0-9) _ . And don't forget the domein (.com .co.uk .be...)
 link:
  label: Link name
  type: text
  hint: "John Smith"
  width: 40
[[/form]]

As you can see this template is devided in to two parts: above and below the separator ("===="). In a normal _template the above part would define how the data is presented after saving or how people with only viewing right will see the page. But in this case, since we are using a redirect the formatting will be used to show the user some info when (s)he decidesto delete the page.
The redirect is within an iftag. So it will only be executed in certain conditions. That's why you first had to add the "_noredirect" tag to the _template.
Below the separator ("====") is the form. As you can see it holds three fields. The first two are from the email (before and after @). The last one is the text the user will see and wich you can use as clickable text to start your email-program. This can be handy for people with strange emails wich not contain there name. It makes sense to see John Smith's name in the list if his email would be moc.liamtoh|321yttocs#moc.liamtoh|321yttocs and not scotty123.

4) Summary code

In wikidot you make lists using the [[ module listpages ]]. Check out that page because the example given here is just one of the many variations you can make. Here is one you can use

[[module listpages category="email-form" separate="no"]]
||[%%form_data{name}%%@%%form_data{domein}%% %%form_data{link}%%] ||%%form_data{name}%%@%%form_data{domein}%%|| [http://emailfield.wikidot.com/email-form:%%name%%/edit/true/noredirect/true Edit]||
[[/module]]

5) Autonumbering ON

go to the admin:manage page (or site manager) and click on "autonumbering of pages" in the navigation. Click thereafter on "+add autonumbering" and select in the next appearing dropdown box the category you've just created. In this example it was "email-form". To confirm click on button "add autonumbering".

6) Some extra's.

I've added an edit and a delete link to the list. Well you can imagen that errors may occur and you wish to correct them. So in that link the suffix "/noredirect/true" is added to the link. This it to disable the redirect module.

DONE!

Now you only need to fill up your list and the result will be like the list below.

Email List

moc.serutnevda|yrt.steL#eednuD elidocorC moc.serutnevda|yrt.steL#moc.serutnevda|yrt.steL Edit Delete
moc.doowylloh|namdiK.elokiN#namdiK elokiN moc.doowylloh|namdiK.elokiN#moc.doowylloh|namdiK.elokiN Edit Delete
moc.todikiw|liameym#xkcirednyeH nevetS moc.todikiw|liameym#moc.todikiw|liameym Edit Delete
Add a New Comment
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License