Может ли кто-нибудь помочь мне сформировать обработчик представления для этих страниц?Мне нужно, чтобы создать новый файл php или html, который имеет дату и заголовок blogpost в виде ссылки html или php. Пример : 12162018BlogPost.html <- Для предотвращения стирания предыдущих файлов при создании. </em>
Каждый необходимый отредактированный раздел помечен знаком "<! - Редактирование-> "
Ссылки были предоставлены для удобства доступа.
Форма отправки : HTML ниже
<!--Editing-->
<form id="submission" method="post" action="submission-handler.php" enctype="multipart/form-data">
Blog Title:<center><textarea name="header" type="text" class="form-control" placeholder="Blog Post Header" rows="2" required></textarea></center>
<br>
Blog Content:<center><textarea name="message" class="form-control" placeholder="Type your blog post here" rows="10" required></textarea></center>
<br>
Upload an image: (Not Currently Working)
<center><input type="file" name="filetoupload" id="filetoupload">
<select>
<option selected="selected" value="noimage">No Image</option>
<option value="wrapleft">Image on Left</option>
<option value="wrapright">Image on Right</option>
<option value="nowrap">Image Centered</option>
</select></center>
<br>
<br>
<hr>
<br>
<br>
<input type="submit" class="form-control submit" value="Preview Post" disabled>
<input type="submit" class="form-control submit" value="Finalize Post" disabled>
</form>
<!--/Editing-->
Шаблон сообщения : заголовок, заголовок, фотография и сообщение HTML, помеченные заголовком $ и $ message
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" content="width=device-width, initial-scale=1.0">
<!--Blog Post Name as Title-->
<!--Editing-->
<title><?php echo = '$header'; ?> | Insert Name | TimeScape Inc</title>
<!--/Editing-->
<link rel="stylesheet" type="text/css" href="Resources/CSS/main.css">
<link href="Resources/CSS/Extra.css" rel="stylesheet" type="text/css">
<link rel="shortcut icon" type="image/x-icon" href="../../../favicon.png" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-100075704-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-100075704-1');
</script>
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script>
(adsbygoogle = window.adsbygoogle || []).push({
google_ad_client: "ca-pub-8019229992747723",
enable_page_level_ads: true
});
</script>
<!-- Hotjar Tracking Code for www.timescapeinc.com -->
<script>
(function(h,o,t,j,a,r){
h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};
h._hjSettings={hjid:990575,hjsv:6};
a=o.getElementsByTagName('head')[0];
r=o.createElement('script');r.async=1;
r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;
a.appendChild(r);
})(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');
</script>
</head>
<body>
<!--Background-->
<div id="back"></div>
<div id="front"></div>
<div id="front2"></div>
<!--Navigation bar-->
<div id="nav-placeholder">
</div>
<script>
$(function(){
$("#nav-placeholder").load("../../../nav.html");
});
</script>
<!--end of Navigation bar-->
<!--Body-->
<div id="wrapper">
<ul class="social"><li><div id="propicture"><div class="profile"><img src="Resources/IMG/7d1a3f77eee9f34782c6f88e97a6c888.jpg"></div></div></li><li><div class="information">
<!--Edit Information below-->
<p><h2><Insert Name></h2></p>
<p><nav><ul class="social">
<!--Social Media 1-->
<li><a href="https://facebook.com/editthis"><img height="50" src="Resources/IMG/cfacebook.png" alt="facebook"></a></li>
<!--Social Media 2-->
<li><a href="https://plus.google.com/editthis"><img height="50" src="Resources/IMG/cG+.png" alt="google+"></a></li>
<!--Social Media 3-->
<li><a href="https://youtube.com/editthis"><img height="50" src="Resources/IMG/cYT.png" alt="youtube"></a></li>
<!--Social Media 4-->
<li><a href="https://twitter.com/editthis"><img height="50" src="Resources/IMG/ctwitter.png" alt="twitter"></a></li></ul>
</nav></p></div>
</li></ul>
<!--About Section-->
<div class="container">
<!--Editing-->
<!--Generate Lorem Ipsum by typing lorem(number) then press tab-->
<center><h1><?php echo = '$header'; ?></h1></center>
<!--idk how to change below to image location and location value
Example of location value: "nowrap", "wrapleft", "wrapright", "noimage"
image location is "Resources/IMG/<Uploaded image>" -->
<?php <img class="nowrap" src="Resources/IMG/755118806-cloudscape-moving-clouds-horizon-over-land-rural-scene.jpg">; ?>
<p><?php echo = '$message'; ?></p>
<!--/Editing-->
</div>
<!--Blog Content-->
<div class="selection">
<div id="disqus_thread"></div>
<script>
/**
* RECOMMENDED CONFIGURATION VARIABLES: EDIT AND UNCOMMENT THE SECTION BELOW TO INSERT DYNAMIC VALUES FROM YOUR PLATFORM OR CMS.
* LEARN WHY DEFINING THESE VARIABLES IS IMPORTANT: https://disqus.com/admin/universalcode/#configuration-variables*/
/*
var disqus_config = function () {
this.page.url = PAGE_URL; // Replace PAGE_URL with your page's canonical URL variable
this.page.identifier = PAGE_IDENTIFIER; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
};
*/
(function() { // DON'T EDIT BELOW THIS LINE
var d = document, s = d.createElement('script');
s.src = 'https://timescapeinc.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript><br/><br/></div></div>
<!--Footer-->
<div class="outer" align="center">
<div class="footer">
<p>TimeScape Inc</p>
<script type="text/javascript" src="https://www.freevisitorcounters.com/en/home/counter/376592/t/5"></script>
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script>
(adsbygoogle = window.adsbygoogle || []).push({
google_ad_client: "ca-pub-8019229992747723",
enable_page_level_ads: true
});
</script>
</div>
</div>
<!--Share Buttons-->
<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-5b67cad9677767c0"></script>
<script id="dsq-count-scr" src="//timescapeinc.disqus.com/count.js" async></script>
</body>
</html>
Любые дополнительные детали, не стесняйтесь спрашивать.Я готов ответить на любые вопросы.
Текущий обработчик представления Я не знаю, что делаю
<?php
$newcontent = file_get_contents("template.html");
//For Image upload
$allow = array("jpg", "jpeg", "gif", "png");
$todir = 'Resources/IMG/';
if ( !!$_FILES['file']['tmp_name'] ) // is the file uploaded yet?
{
$info = explode('.', strtolower( $_FILES['file']['name']) ); // whats the extension of the file
if ( in_array( end($info), $allow) ) // is this file allowed
{
if ( move_uploaded_file( $_FILES['file']['tmp_name'], $todir . basename($_FILES['file']['name'] ) ) )
{
// the file has been moved correctly
}
}
else
{
// error this file ext is not allowed
}
}
?>
Заранее спасибо!