I am creating a contact page. I have created templates to display the header, contact form, and footer. When a user's email is sent how can I send back a page to the user? I will use templating for the success page.
<?php
/* *********************************************
* mustache library
* ********************************************* */
require_once 'mustache/mustache/src/Mustache/Autoloader.php';
Mustache_Autoloader::register();
$mustache = new Mustache_Engine;
$header = file_get_contents('templates/header.html');
$body = file_get_contents('templates/emailform.html');
$footer = file_get_contents('templates/footer.html');
$header_data = ["pagetitle" => "Contact"];
$footer_data = [
"localtime" => date('l jS \of F Y h:i:s A'),
"footertitle" => "Contact"];
echo $mustache->render($header, $header_data) . PHP_EOL;
echo $mustache->render($body) . PHP_EOL;
echo $mustache->render($footer, $footer_data) . PHP_EOL;
function successpage() {
$body = file_get_contents('templates/success_contact.html');
}
function failurepage() {
$body = file_get_contents('templates/failure_contact.html');
}
source https://stackoverflow.com/questions/71414105/can-there-be-two-body-templates-to-send-back-a-new-page
No comments:
Post a Comment