Added a nice HTML-template for a real blog

This commit is contained in:
Jack-Benny Persson 2014-06-25 21:40:41 +02:00
parent 64766c4ea7
commit 72808dd6d5
6 changed files with 249 additions and 7 deletions

View File

@ -1,4 +1,4 @@
Copyright (C) 2013 Jack-Benny Persson <jack-benny@cyberinfo.se>
Copyright (C) 2013-2014 Jack-Benny Persson <jack-benny@cyberinfo.se>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,17 +1,36 @@
simplog
=======
simplog is a (very) simple PHP blog engine. It's supposed to be implemented into an existing webpage since this in only the engine part and does not contain a complete webpage/blog of any kind. It's also intended to only have a single user.
simplog is a (very) simple PHP blog engine. It's supposed to be implemented into
an existing webpage since this in only the engine part and does not contain a
complete webpage/blog of any kind. It's also intended to only have a single
user.
What's missing?
---------------
Not much really as of 2013-07-27, depending on how you plan to use it. Included is a template to create the MySQL table, a small HTML and PHP file to create new posts, a simplog.php file that displays your posts and a config file to connect to a database and set number of posts per page. Now there is also a HTML file to find your posts and edit/update them.
Not much really as of 2013-07-27, depending on how you plan to use it. Included
is a template to create the MySQL table, a small HTML and PHP file to create
new posts, a simplog.php file that displays your posts and a config file to
connect to a database and set number of posts per page. Now there is also a
HTML file to find your posts and edit/update them.
You no longer need to protect the user/ directory yourself. Authentication is done using the database.
You no longer need to protect the user/ directory yourself. Authentication is
done using the database.
Since of 2014-06-25 there is also nice HTML-template for a real blog. So now
it's possible to just upload it and start blogging away!
Usage
-----
simplog.php is intended to be included (with php include) on your webpage, therefore simplog.php doesn't include any HTML start/end tags or anything like that. That's for your webpage to handle, simplog is made as clean as possible for this reason. The includes and user directory also needs to be on your server in the same directory, they include important files. In the user directory you can create new posts and edit existing ones. To edit a post click on Edit post (in /user) and fill in the date and title of the post you want to edit. Hit Find post to find the post or posts matching. Now you can edit the post.
simplog.php is intended to be included (with php include) on your webpage,
therefore simplog.php doesn't include any HTML start/end tags or anything
like that. That's for your webpage to handle, simplog is made as clean as
possible for this reason. The includes and user directory also needs to be on
your server in the same directory, they include important files. In the user
directory you can create new posts and edit existing ones. To edit a post click
on Edit post (in /user) and fill in the date and title of the post you want to
edit. Hit Find post to find the post or posts matching. Now you can edit the
post.
How do I create the MySQL table?
--------------------------------
@ -29,10 +48,18 @@ Option 2) Run this command from the shell:
You'll be asked to enter the password for the user, enter it.
Now you have created the table for the blog. Now you can start filling it with blog posts.
Now you have created the table for the blog. Now you can start filling it with
blog posts.
Screenshot
----------
![alt text](screenshots/blog.png "Blog")
Contributing
------------
Any contributions are welcome since this is a work in progress.
Add yourself to the THANKS file if you like to after contributing to the project.
Add yourself to the THANKS file if you like to after contributing to the
project.

BIN
background.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

107
blogsite.css Normal file
View File

@ -0,0 +1,107 @@
body
{
font-family:Verdana,Tahoma,Arial,sans-serif;
background:url(background.png) repeat-y top center;
}
#wrapper
{
margin:auto;
width:850px;
border:1px solid black;
border-radius:8px;
background-color:#FFFFFF;
}
#navbar
{
margin:0px 0px 0px 0px;
padding:0px 2px 2px 2px;
background-color:#1E90FF;
border-bottom:3px solid black;
height:80px;
border-radius:8px 8px 0px 0px;
text-align:center;
}
#logo
{
float:left;
}
#navlink-right
{
float:right;
}
#content
{
margin:2px 2px 2px 2px;
padding:0px 2px 2px 2px;
border:0px solid black;
/*border-radius:2px;*/
font-size:0.9em;
}
#footer
{
margin:0px 0px 0px 0px;
padding:0px 2px 2px 2px;
border-top:3px solid black;
/*border-radius:2px;*/
text-align:center;
font-size:0.7em;
}
.ul-links
{
list-style-type:none;
margin-left:-25px;
margin-top:20px;
}
.link
{
display: inline;
border: 2px solid #000000;
font-family: Arial, sans-serif;
color: #ffffff;
padding: 5px;
border-radius: 5px 5px;
background-color: #FFA500
}
.link a:link
{
color:#FFFFFF;
text-decoration:none;
}
.link a:visited
{
color:#FFFFFF;
text-decoration:none;
}
.link a:hover
{
color:#000000;
text-decoration:underline;
}
a:link
{
color:#000000;
text-decoration:none;
}
a:hover
{
color:#000000;
text-decoration:underline;
}
a:visited
{
color:#000000;
}

108
blogsite.php Normal file
View File

@ -0,0 +1,108 @@
<!--
Copyright 2014 Jack-Benny Persson <jack-benny@cyberinfo.se>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA.
-->
<!DOCTYPE html>
<head>
<title>My Blog</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<meta name="description" content="jackbenny" />
<meta name="keywords" content="linux,html,css" />
<meta name="author" content="Jack-Benny Persson" />
<link type="text/css" rel="stylesheet" href="blogsite.css">
</head>
<body>
<div id="wrapper">
<div id="navbar">
<div id="navlink-right">
<ul class="ul-links">
<li class="link"><a href="#">Home</a></li>
<li class="link"><a href="#">About</a></li>
<li class="link"><a href="#">Articles</a></li>
<li class="link"><a href="#">Contact</a></li>
</ul>
</div>
<div id="logo">
<h1>My Blog and My Life</h1>
</div>
</div>
<div id="content">
<?php
// Include config file and other include-files
require "includes/config.php";
require "includes/dbconnect.php";
// Divide the posts into pages, N number of posts on every page
if (isset($_GET['page']))
{
$page = $_GET['page'];
}
else
{
$page=1;
}
$start = ($page-1) * $posts_per_page;
$query = "SELECT * FROM blog ORDER BY date DESC LIMIT $start,
$posts_per_page";
$result = mysql_query($query)
or die("No matching queries...");
// Printing posts in HTML
while ($line = mysql_fetch_array($result))
{
print "<h2>$line[title]</h2>\n<p>";
print "$line[posttext]\n<br />";
print "Posted on: $line[date]";
print "</p>\n\n";
}
// Printing page links
$query = "SELECT COUNT(title) FROM blog";
$result = mysql_query($query);
$rows = mysql_fetch_row($result);
$total_posts = $rows[0];
$total_posts = ceil($total_posts / $posts_per_page);
print "<strong>Page: ";
for ($i=1; $i<=$total_posts; $i++)
{
print "<a href='blogsite.php?page=".$i."'>".$i."</a> ";
}
print "</strong>";
// Close MySQL link
require "includes/dbclose.php";
?>
</div>
<div id="footer">
<p>&copy; 2014 - Jack-Benny Persson</p>
</div>
</div>
</body>
</html>

BIN
screenshots/blog.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 KiB