Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/funkydan2/alpha-church.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Saunders <daniel.saunders@gmail.com>2020-09-04 02:28:12 +0300
committerDaniel Saunders <daniel.saunders@gmail.com>2020-09-04 02:28:12 +0300
commit4b2ba97d7961acec2167daa39603f71213d45ebb (patch)
treea11e14e3184f7d977109c65590e50cc1d247cf91
parent7cf76944253cb48483139b581ac13a5096038a9d (diff)
parent1423be6a0b5db3a7d1445b4379fa7cd16ae8d0d6 (diff)
Merge branch 'master' of https://github.com/funkydan2/alpha-church
-rw-r--r--exampleSite/config.toml5
-rw-r--r--exampleSite/static/contact_mail.php37
-rw-r--r--layouts/partials/contact.html55
-rw-r--r--layouts/partials/header.html2
4 files changed, 80 insertions, 19 deletions
diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index bc4eee8..0d177bf 100644
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -126,12 +126,15 @@ unsafe = true
[params.contact]
#Use this section to automate contact form.
- #Set service to either "netlify" or "formspree"
+ #Set service to either "netlify", "formspree" or "php"
#For formspree, please setup an account at https://formspree.io/
#For netlify, please read https://www.netlify.com/docs/form-handling/
#
#If you use netlify, you'll need to set the confirm_page value (or else users will see a generic netlify response)
#If you use formspree, you'll need to set your formspree email address.
+ #
+ #If you use php, you need to host this site on a Server capable of running php.
+ # Please edit the /static/contact_mail.php file from the exampleSite.
service = "netlify"
confirm_page = "/contact_thanks"
# formspree_email=""
diff --git a/exampleSite/static/contact_mail.php b/exampleSite/static/contact_mail.php
new file mode 100644
index 0000000..755f34f
--- /dev/null
+++ b/exampleSite/static/contact_mail.php
@@ -0,0 +1,37 @@
+<?php
+# Edit the following 5 variables to fit your needs!
+
+# Recipient of the Mail:
+$to = "admin@example.org";
+# The "from" address of the Mail. This should match the domain of the server:
+$from = "website@example.org";
+# Forward Users to this Page if the mail is successfully sent:
+$confirm_page = "/contact_thanks";
+# If something goes wrong and sending the mail fails, forward users to:
+$error_page = "/404.html";
+# Specify the Subject of the Mail:
+$subject = "Feedback from example.org";
+
+
+if (isset($_POST['send'])) {
+ $message = "Name: " . $_POST['name'] . "\r\n\r\n";
+ $message .= "Email: " . $_POST['email'] . "\r\n\r\n";
+ $message .= "Message: " . $_POST['message'] . "\r\n\r\n";
+
+ $headers = "From: " . $from . "\r\n";
+ $headers .= "Content-Type: text/plain; charset: utf-8";
+ $email_ok = filter_input(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL);
+ if ($email_ok) {
+ $headers .= "\r\nReply-To: $email";
+ }
+
+ $success = mail($to, $subject, $message, $headers);
+
+ if (isset($success) && $success){
+ header("Location: ".$confirm_page);
+ exit;
+ }
+}
+header("Location: ".$error_page);
+exit;
+?> \ No newline at end of file
diff --git a/layouts/partials/contact.html b/layouts/partials/contact.html
index d907219..5632339 100644
--- a/layouts/partials/contact.html
+++ b/layouts/partials/contact.html
@@ -48,22 +48,43 @@
</div>
</form>
{{ else if eq .Site.Params.Contact.service "formspree" }}
- <form method="POST" action="https://formspree.io/{{ .Site.Params.Contact.formspree_email }}">
- <div class="row gtr-50 gtr-uniform">
- <div class="col-6 col-12-mobilep">
- <input type="text" name="name" id="name" value="" aria-label="Name" placeholder="Name" />
- </div>
- <div class="col-6 col-12-mobilep">
- <input type="email" name="_replyto" id="email" value="" aria-label="Email" placeholder="Email" />
- </div>
- <div class="col-12">
- <textarea name="message" id="message" aria-label="Enter your message" placeholder="Enter your message" rows="6"></textarea>
- </div>
- <div class="col-12">
- <ul class="actions special">
- <li><input type="submit" value="Send Message" /></li>
- </ul>
- </div>
+ <form method="POST" action="https://formspree.io/{{ .Site.Params.Contact.formspree_email }}">
+ <div class="row gtr-50 gtr-uniform">
+ <div class="col-6 col-12-mobilep">
+ <input type="text" name="name" id="name" value="" aria-label="Name" placeholder="Name" />
+ </div>
+ <div class="col-6 col-12-mobilep">
+ <input type="email" name="_replyto" id="email" value="" aria-label="Email" placeholder="Email" />
+ </div>
+ <div class="col-12">
+ <textarea name="message" id="message" aria-label="Enter your message" placeholder="Enter your message" rows="6"></textarea>
+ </div>
+ <div class="col-12">
+ <ul class="actions special">
+ <li><input type="submit" value="Send Message" /></li>
+ </ul>
</div>
- </form>
+ </div>
+ </form>
+{{ else if eq .Site.Params.Contact.service "php" }}
+ <form name="contact" method="POST" action="/contact_mail.php" netlify>
+ <div class="row gtr-50 gtr-uniform">
+ <div class="col-6 col-12-mobilep">
+ <input type="text" name="name" aria-label="Your name" placeholder="Your name">
+ </div>
+ <div class="col-6 col-12-mobilep">
+ <input type="email" name="email" aria-label="Email address" placeholder = "Email address">
+ </div>
+ <div class="col-12">
+ <textarea name="message" aria-label="Enter your message" placeholder="Enter your message" rows="6"></textarea>
+ </div>
+ <div class="col-12">
+ <ul class="actions special">
+ <li>
+ <input type="submit" value="Send" name="send"/>
+ </li>
+ </ul>
+ </div>
+ </div>
+ </form>
{{ end }}
diff --git a/layouts/partials/header.html b/layouts/partials/header.html
index 2578736..497d902 100644
--- a/layouts/partials/header.html
+++ b/layouts/partials/header.html
@@ -1,7 +1,7 @@
<!DOCTYPE HTML>
{{ with .Site.Params.languageCode }}<html lang="{{ . }}">{{ end }}
<head>
- <title>{{ .Site.Params.title }}</title>
+ <title>{{ if .Title }}{{ .Title }} | {{ end }} {{ .Site.Params.title }}</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
{{ with .Site.Params.subtitle }}<meta name="description" content="{{ . }}">{{ end }}