I have been searching online for a tutorial but I guess we can say that search engines are "polluted" with WordPress and Blogger.
Here is my problem:
I followed this tutorial and it went quite well, everything works as I wanted. But now I would like to have a function where the admin (that is writing a new blog entry) has the option to decide when is the blog entry going to be on-line (hh/dd/yy).
Does anyone know of a tutorial, demo, tips, whatever that can help?
I know I could use Blogger or WordPress, but I don't want to. This would have the additional purpose of learning some more PHP.
I looked at the "Build a Blog" articles. It seems to me that you do not need to change very much. Here is some kind of recipe / hint / suggestion :
Change the "whole script" to
$sql = "CREATE TABLE php_blog (
id int(20) NOT NULL auto_increment,
timestamp int(20) NOT NULL,
title varchar(255) NOT NULL,
entry longtext NOT NULL,
published date, <--- this is the change
PRIMARY KEY (id)
)";
Use a tool like PHPMyadmin if you want to alter an existing table.
Add this inside <form>
:
<input type="text" name="published" id="published" value="" />
Inside if (isset($_POST['submit'])) {
add
$published = $_POST['published'];
Additional, right after - if the user has not entered a publish-date, that must be in the form m/d/y :
if ($published=='') $published = date("m/d/Y");
Change the SQL :
$sql = "INSERT INTO php_blog (timestamp,title,entry,published) VALUES ('$timestamp','$title','$entry','$published')";
Change the SQL
$sql = "SELECT * FROM php_blog WHERE id='$id' and published<CURRENT_TIMESTAMP LIMIT 1";
This is only to point to a start / give a kind of recipe.
The "Build a Blog" system is very, very simple, so I think its pretty much that. If you get it to work, you will need more coding regarding the next chapters, but I hope it could be a starting point. I like the idea of people trying to make their own tool themselves, and in the process learn how to do it. Much better.
If you started with a blog system like WordPress, you would just meet another kind of problems - most likely even more frustrating. It is better to have control, rather than waste the time to correct other people's coding mistakes.