Movable Type 플랫폼을 사용하는 회사의 연락처 양식을 쓰려고합니다. 내가 사용할 페이지 템플릿을 만드는 중입니다. 나는 나의 PHP 코드와 HTML이 테이블에 대해 정확하고 서로를 참조한다는 것을 95 % 확신한다. 이것은 문제의 원인이 아니다. 그러나 MT는 자동으로 PHP를 렌더링하지 않습니다. 대신 모든 PHP 텍스트의 거대한 블록을 얻습니다. html로 렌더링하면됩니다. MT가 PHP를 인식하도록하는 방법을 잘 모르겠습니다. 이 문제를 직접적으로 해결하는 설정이나 아무것도 찾을 수 없습니다. 가장 가까운 MT 도움말/FAQ 영역에서 찾을 수 있습니다 here입니다. 하지만 그들이 제공하는 코드를 사용하여 시도했습니다 <$MTEntryText encode_php="here"$>
하지만 그것은 페이지가 렌더링하는 방법에 대해 전혀 바뀌지 않습니다. 아래는 내가 사용하려고하는 PHP이지만, 문제의 원인이라고 생각하지 않습니다. 나는 그것을 대비해서 포함시켜야한다고 생각했다. MT에 대한 태그를 어떻게 지정해야하는지 요점을 놓치고 있습니까? 저는 처음으로 Movable Type 플랫폼에서 작업하고 있으며, 제 3의 ish 시간 동안 PHP를 사용하고 있기 때문에, 제가 빠진 것을 설명 할 때 저는 어린 아이처럼 저와 이야기하게 자유롭게 이야기하십시오.이동식 페이지 템플릿의 PHP 코드
<?php
if(isset($_POST['email'])) {
// EDIT THE 2 LINES BELOW AS REQUIRED
$email_to = "[email protected]";
$email_subject = "Web Contact Response";
function died($error) {
echo "We are very sorry, but there were error(s) found with the form you submitted. ";
echo "These errors appear below.<br /><br />";
echo $error."<br /><br />";
echo "Please go back and fix these errors.<br /><br />";
die();
}
// validation expected data exists
if(!isset($_POST['name']) ||
!isset($_POST['email']) ||
!isset($_POST['telephone']) ||
!isset($_POST['comments'])) {
died('We are sorry, but there appears to be a problem with the form you submitted.');
}
$name = $_POST['name']; // required
$email_from = $_POST['email']; // required
$telephone = $_POST['telephone']; // not required
$comments = $_POST['comments']; // not required
$error_message = "";
$email_exp = '/^[A-Za-z0-9._%-][email protected][A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
if(!preg_match($email_exp,$email_from)) {
$error_message .= 'The Email Address you entered does not appear to be valid.<br />';
}
$string_exp = "/^[A-Za-z .'-]+$/";
if(!preg_match($string_exp,$first_name)) {
$error_message .= 'The First Name you entered does not appear to be valid.<br />';
}
if(!preg_match($string_exp,$last_name)) {
$error_message .= 'The Last Name you entered does not appear to be valid.<br />';
}
if(strlen($comments) < 2) {
$error_message .= 'The Comments you entered do not appear to be valid.<br />';
}
if(strlen($error_message) > 0) {
died($error_message);
}
$email_message = "Form details below.\n\n";
function clean_string($string) {
$bad = array("content-type","bcc:","to:","cc:","href");
return str_replace($bad,"",$string);
}
$email_message .= "Name: ".clean_string($name)."\n";
$email_message .= "Email: ".clean_string($email_from)."\n";
$email_message .= "Telephone: ".clean_string($telephone)."\n";
$email_message .= "Comments: ".clean_string($comments)."\n";
// create email headers
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);
?>
Thank you for contacting us. We will be in touch with you very soon.
<?php
}
?>
당신은 PHP와 .html 파일 확장자를 넣는 위치를 정확하게 추측했습니다. 나는 일을 그만두려고하지만, 내일은 일을 먼저 시도하고 어떤 일이 일어나는지 살펴볼 것입니다. – ulalu