Blog Documentation
Blog Documentation
2011
Prince Akyereko
2011| 66
Paivi Nygren
Prince Akyereko
Gathering the user requirements was done through reading of the documentation
accompanying the project, reading the manuals of the older blog system and interaction with
other developers and owners of the project. The goal was to build a web blog system for the
users to send, read and comment on posts.
The blog was built with PHP, CSS, MySQL, JavaScript, and HTML. It has both the
administrator‟s and the registered users‟ interfaces. The system was tested on the most
common browsers.
1 INTRODUCTION 7
2 BACKGROUND 10
2.1 Advantages of Blogs 11
2.2 Disadvantages of Blogs 13
2.3 Making a Blog 13
3 WEB BLOG FOR DEVELOPERS HELSINKI OY 16
3.1 The current system and Problems Associated with It 16
3.2 Gathering User Requirements 16
3.3 Building the Application Process 18
4 HOW THE SYSTEM WORKS 25
4.1 Creating Really Simple Syndication (RSS) Feed for the Blog 37
5 TESTING THE APPLICATION 38
5.1 Layout Testing 38
5.2 Functional Testing 42
6 SUMMARY 47
SOURCE MATERIAL 49
APPENDICES
Appendix 1 Application Codes 50
Appendix 2 Other UML Diagrams of the system 64
SCREENSHOTS
Screenshot 1: Login page 24
Screenshot 9: Searching for post result in the system by a visitor called “kojo” 36
Screenshot 10: Layout testing in internet explorer 39
FIFURES
TABLES
Table 6: PHP Code that lists all posts on the Page (listing_post.php) 52
Table 7: Commenting on post code 53
Table 9: HTML and PHP code that creates the Blog Home page (index.php) 55
Table 13: Headers and Footers. It has both header.php and footer.php 63
LIST OF ABBREVIATIONS
1 INTRODUCTION
The invention of the internet in the 19th century paved way for many ways of
communication. Websites are integral part of communication in our everyday
online activities. Nowadays with the availability of internet in every home
blogging is becoming more and more popular.
Today blogs and other websites have become a source of information for many
people and organizations all over the world. Schools, government and private
organizations, journalists, news houses etc. all depends on a web blog system
to tell us the information that we need and inspire us to visit their web pages
every day. (Wikimedia Foundation, Florida, USA, 2010.) Therefore, there should
always be an easy way anybody can post and edit something into a website
that they have right to without needing to edit the programming code. Without a
web blog system being incorporated in a web page, it is always going to be
difficult for people to post and add information to their websites everyday.
This project focuses on building a web blog system from the scratch for
Developer‟s Helsinki Oy using HTML, CSS, PHP, MySQL, JavaScript etc.
MySQL was the database server used to store the blog posts and PHP was the
scripting language used to put content into the database and bring it back into
the weblog. The building of the application began by reading the project
documentation submitted to me by the company and a personal discussion with
the project manager and other developers.
The project shows a way of designing a blog that will be user friendly and allows
its visitors to be part of the system. The visitors who read the posts will be
allowed to contribute and comment on the posts and their comments will be
available to the entire audience. The system was designed in two phases.
There is the administrator interface and the home page for the blog posts to
appear for the visitor. The administration site allows the administrator to post
and edit blog posts. Moreover, it allows him/her to list the posts and delete any
post that is no more relevant and must be removed from the system. The
administrator interface is where the blog post is composed before it can be
posted to the home page for the visitors to see. The home page for the blog is
where the most recent posts are shown. It also has the search facility and
archives area where the older posts can be seen. The part of the blog that
invites the visitor or the user to be part of the system by contributing and leaving
comments motivates and attracts some people to visit the page.
There is also the Really Simple Syndication (RSS) feed for the blog. The
RSS feed is a way in which websites distributes their contents. ‘An RSS feed
is an XML file that tells the outside world when you have updated your blog
so your readers do not need to keep coming back to your website to find out
whether you made any changes. It defines an easy way to share the website
updates, headlines and news to regular customers who has subscribed to the
RSS feeds of the website‟. (Andy Budd et al., 2006, 329.)
In designing the system, the developer has taken into consideration the needs
of the final user and how the user will interact with the system. The user and the
company‟s requirements are those implemented here with the view of achieving
the client‟s needs. Every technology used in this project is by the request of the
customer. A database of the blog and other tools used in the system conform to
the contemporary design rules of the company.
In the future, the blog could be modified and improved to have more functions
with time. A feature could be added which will allow one to post and preview his
post in the administrator area before they are finally posted onto the blog. In
addition, the same preview section could be added to the comments area also.
Moreover, in the future, other ready made tools such as Textile and Markdown
could be added to the blog to allow good and more advanced formatting. It is
possible to add categorization system to the blog posts which will allow the
posts to be categorized
A sample of people was selected to test the system and give feed back.
Developer‟s Helsinki Oy has acknowledged the system and has implemented it
2 BACKGROUND
Blogging kicked off big style in 2004. It was around for quite a few years before
that, but not really mainstream. The word “blog” certainly couldn‟t be found in
the pages of a dictionary and was only used in conversations online, by those
who were “in the know”. These days, you hear it everywhere. (Andy Budd et al.,
2006, 5.)
Majority of blogs are interactive, allowing visitors to post comments and even
message each other through gadgets on the blogs and it is this interactivity that
differentiates them from other static websites. So many blogs provide a written
explanation on a particular theme; others function as more personal online log.
A typical blog combines text, other inputs, images, and links to other blogs,
websites, and other communications related to its subject. Today, the ability of
readers to post comments in an interactive way is an integral and essential part
of many blogs. A lot of blogs are mainly textual, notwithstanding some blogs
focus on music (MP3 blog), art (Art blog), videos (video blogging), audio
(podcasting), and photographs (photo blog). There is another type of blogging
which give prominence to very short posts. This way of blogging is called Micro
Again, a blog can also be described as a website that allows users to reflect,
give opinions, and talk about various subjects in the form of an online journal
while readers may comment on posts. Posts usually appear in a reverse
sequential order. (Mediawiki, Creative Commons Attribution-Share Alike, 2002.)
Apart from those types of blogs mention above which are mainly categorized by
the media type, there are other different types of blogs which needs to be
mentioned. Among of these, the differences are seen based on the way or the
purpose in which the blog is used for. Some blogs are use for personal purpose
while others are for political reasons and other reasons (Wikimedia Foundation,
Florida, US, 2010).
A blog on the other hand can also be categorized by a genre. Normally, this
type of a blog is written purposely with a focus on a particular subject such as
political blog, educational blog, and legal blogs. (Wikimedia Foundation, Florida,
US, 2010).
A web blog with shorter entries and blend media type is called tumble log. A
blog that is written on typewriters and then scanned is called typecast. Also a
blog can be described by the device being used to send or to compose it. A
blog written by a mobile device like a mobile phone is called a mob log.
(Wikimedia Foundation, Florida, USA, 2010.)
The basic advantage of having a blog is to enable a user to share their views
and opinions about a particular topic. On the hand, a unique feature of a blog is
the ability to let registered users comment on what they read. This lets
interested individuals discuss that particular topic. This leads to further
exchange of information and ideas. (Wetzel, 2010.)
There are quite a few major blog hosting sites that offer various features that
enable users to determine how they wish to express their opinions. For
example, a blog hosting site may offer various different templates which would
make it attractive or perhaps try to make creative parallels between the writer's
ideas. (Wetzel, 2010.) This unique display style implemented by the blogger
creates a persona that attracts like minded individuals, thus creating a sense of
community with dissemination of interesting information. In essence, blogs are
easy to maintain because they are organized in chronological order. For
example, a reader would be able to access a blog according to time if they wish,
or they can search with respect to the topic titles. (Wetzel, 2010.)
An important thing to note about blogs is that they are easy to edit as well. That
is because the only thing required is login information and access to internet.
This makes it easy for bloggers to express their views wherever they may be.
(Wetzel, 2010.)
Another significant advantage of blogs is that it lets users share their views
when they might not be given a voice due to selectiveness of other media (such
as newspapers, magazines and other forms of publications) (Wetzel, 2010).
That is because these print media have limited capacity and they must choose
what might be in the best interest of their organization, hence the selectiveness.
On the contrary, in the blogosphere there is virtually no limit as to how much
and how well one would like to express his/herself. As a result, people choose
to express their feelings and views on the blogosphere depending on what they
feel like sharing. (Miller & Pole, 2010.) Interestingly though, blogging also
creates an opportunity for bloggers to be picked up by news media as a
supplement to their news stories. For instance, when the iPhone was leaked, all
the anticipated information was acquired from the Gizmodo technology blog. As
a result, Gizmodo enjoyed the fame that it probably would not have been able
The main product of blogging is the spread of information. When individuals talk
about a particular topic, they tend to get into a discussion highlighting the
benefits and risks associated. Therefore, the most harmful thing to come out of
a blog discussion is negative publicity of a particular product. For example, if
one is discussing a health product and someone makes a comment about the
side effects, the comment could potentially harm subsequent sales of that
particular product. (Wetzel, 2010.)
A web blog like any other website can be programmed using a lot of modern
day web technologies. It can be programmed with HTML, CSS, JavaScript,
PHP, HTML, CSS, ASP, Python etc and even with XML. On the other hand, a
blog can be created without the need to know any of the above web
applications and how to code. Today building sites such as Movable Type,
Dynamic websites normally provide the visitor or the user with the ability to
interact with the content and give some form of feedback. However, the reason
for calling these sites dynamic has to do with how the sites are developed and
maintained. In the dynamic web site, all of the content, styling files and related
web documents are contained within one or more databases located
somewhere on the Web and normally administered by an application called a
Content Management System. (Acroterion, 2001-2007.) The content is
cascaded on the website using various templates written in a dynamic mark-up
language such as PHP, JAVA, and ASP. These languages are like HTML, but
they are more complicated and can do a great number of things than common
HTML. Creating pages dynamically allows for all sorts of intelligent applications,
from e-commerce, random quote generators to full on web applications such as
Facebook, Twitter and MSN. (Acriterion, 2001-2007.)
Static weblog or website on the other hand is one that its pages are stored on
the server in the format that is sent to a client web browser (Acroterion, 2001-
2007). Normally, it is designed in simple HTML and does not use server side
languages like PHP, ASP, Python and other languages available in its
application building. Usually static websites display the same information to its
visitors most of the time. (Acroterion, 2001-2007.)
This project seems to be one of the dynamic blogs around because it allows the
user to interact with blogger by posting comment thus making it interesting for
the user to visit the site all the time. The administrator can also remove a
dangerous or abusive user from the system.
This company builds internet applications and web base systems that add value
to the existing one. The company current website provides information for its
users and customers but does allow the managers of the site to add a message
for its visitors so easily. To add a message one needs to go and edits code
before adding it. That has called for a modest system that will work along with
their website and allow anybody whether somebody with developing experience
or without developing experience to post a message to the site without any
difficulty. Not that there was no website for the company, there was but it was
done at beginning of the company and now needs improvement from the
existing one. So there was the need in design a blog for it, in order to make
communication between the company and the public easier. The older website
was a static one which was not easily to blog everyday. So the company
mooted the idea of new blog to respond to the challenges of today environment.
The first process of gathering information about the project began by first
reading the documentation that accompanies the project. After that I took the
old system to look at it and study it carefully. I investigated the good and bad
features of the older blog. Again I read the user manual and documentation of
the older system that exist in the company archive.
After reading the documentation of both the older and the new system, and
investigated the older system I met the chief operating officer to discuss the
documentation further with him. When I met him I discussed the documentation
with him and tried to understand some of the things I do not understand in the
document in order to gather the requirements well. After the meeting with him
and interaction with other developers I gathered what the system needs to do
and some of the restrictions that must be applied in the design face.
There must be a database for the blog which should include a database table
for post and a database table for comment and also a table for users. Every
blog post must have a unique ID and should be time stamped and posts must
appear in chronological order with the seven most recent ones appearing first.
When an older post is edited, it should not change the original timestamp. Every
post written is also associated with the author or the writer. An author must login
in order to write and post a blog. The entry or post should consists of; title, date,
author name, content, which may include text, styled, links, pictures or
embedded video.
When writing a post or entry for the blog, the following elements, restrictions
and commands must be applied; the title should be a simple input field. It is
required before the text could be submitted. No post or text can be submitted
until a title has been written or entered. A maximum of 140 characters, including
spaces, can be entered into the input field. This input field should be designed
using HTML and CSS should be used to style it. Content is the area where the
discussion of the post takes place and it is necessary to construct this area in a
way that encourages good communication. The author‟s comments should be
designed in a different way so that they are a little bit different and going
through other comments should be easier. The content should be designed with
the user in mind not forgetting the last user.
After gathering the user requirements, I began by first drawing UML diagrams
for the project. I submitted the UML diagrams to the chief operating for
comment and approval. The next day he came to me in the office and
discussed the UML diagrams further with me. He gave me the suggestion as
how to improve my UML diagrams and after further consultations with other
developers let to the drawing of the UML diagrams in both Figure 1, Figure 2,
Figure 3 and Figure 4 below respectively.
The application was built with MySQL and PHP. MySQL is the database server
used to store the blog posts and PHP is the server-side scripting language used
to put content into the database and pull it back out into the home page
template for visitors to access it. The forms and layout were built with HTML,
CSS and JavaScript. The PHP codes were done in NuSphere 3.0.
The application has two users, the administrator and the visitors of the site. The
visitor must log in order to perform other duties apart from just reading the blog
entry. In blog development the administration site where the post is compose
and edited is very important. So this project will show the logic of composing
post and how a registered visitor or administrator can comment on the post
here.
blog_users
blog_post
blog_post_comment
Alert/flag Inapropriate
search for post comment
or archive
log in
request for
editing/updating
password
post
comment on
recive
post
message
deleting post
Visitor(Registered) Create new
Account
Send message
Administrator
The figure above depicts the system‟s actors‟ various roles and how they
interact with the system.
Table 1: Event Table of the Blog System; indicating event, trigger, and source of
the action, activity, response and destination of the action.
Administrator System
Errors in
message? No
submit form
Submit post
Yes
Writes or compose
Comment
Submit
comment
First of all there are other functions of the system do shown in the class
diagram, Use Case diagram, and Event table (Figure 1, 2 and Table 1)
respectively but will talk about it here and will not include the codes of it base on
the agreement I had with this company who owns this project. Examples of
such areas are login and registration code, flagging inappropriate comment and
removing a user from the system.
There are two users of the system. They are administrator and a visitor, the
administrator must log into the system at all time and the visitor must also login
into the system in order to access the facility and be able to comment on post.
The user must input his/her Log in details in order to sign in to the system. On
the other hand if a user inputs wrong or not existing sign in information, the user
will be redirected to the sign up form below to sign up before he/she can long in
to the system.
When the user is redirected here he /she will then input the name, username,
password, and email and then submit it here in order to register. Again if the
user is a new and have not signed up yet, he/she must register the details here
in order to log in and access the facility.
When the user logs in to the system, each user has a set of functions he/she
can perform. In the table below is each user and it roles briefly.
User Function
-update/edit post
-delete post
-comment on post
-send message
- comment on post
Both the administrator and the visitors are supposed to register in order to login
to the system (blog_register.php). During registration the administrator
distinguishes itself from the visitor based on the information entered and the
different user levels available. After registration the administrator is directed to
administrator page. There administrator can add new post (blog_post.php),
edit/update (updatepost.php) or delete (deletepost.php) post. The picture below
shows how an administrator can add post. He/she selects to write post and the
window below appears. The administrator then writes the post and after that
submits it into the database. Below is that form that allows you to write a post
and add it to the system. The HTML and PHP code (blog_post.php) that sends
the post into the database can be found in the Appendix 1.
After a post has been submitted, then the system will send back to you “A new
post was successfully submitted”. If the post is not successfully submitted into
the database an error will come and redirect you to the compose form. Figure 3
in page 22, shows the logic of doing that in the system.
A query String is the list of a name=value pairs in a URL that follow the PHP
file name. You can always see them when using the search engines such as
Google, Yahoo! and Bing. The elements of a query string are possible in PHP
through a super global variable. (Andy Budd et al., 2006, 285.)
After submitted an edited post the system sends back to the screen on the print
out below “Your posted was edited successfully”. “Return to blog home page”.
Deleting post already entered in the system, is one of the functions the
administrator can perform. This function can only be performed by the
administrator. This is a function called delete function built into the index file
(delete.php) in appendix 1 which allows the administrator to do this.
The administrator is able to update and delete post because the system list all
post in sequential order in the page (index.php). Because of the way the system
list posts, an author or administrator can easily select which entry to edit or
delete without any difficulty. The system sorts the posts into dated order with
the recent post being appeared first before any other post. The (index.php)
which do that could be found in Appendix 1.
A unique feature of blogs is the ability to let registered users comment on what
they just read. If there is anything in blogging that attract people to visit your site
all the time, then is the system ability to allow the registered users to comment
on the post. (Wetzel, 2010.) Nowadays in the developing world, a web based
system that fails to make its visitors part of the system is bounded to fail.
Figure 4 and Figure 5 in pages 23, 24, show the activity diagram, and use case
text of commenting on a post. Let us take a registered user (administrator or
visitor) who wants to comment on a post. The user must select the post to
comment on it and the comment form or comment box will appear
(blog_post_comment.php) in appendix 1 and the user can now input his/her
thought and submit it. (Screenshot 7) below shows a registered user
commenting on a post and the outcome.
Screenshot 9: Searching for post result in the system by a visitor called “Kojo”
Another thing a visitor or registered user can do with the system also is
searching for post. Let say there is a visitor call „KOJO‟ and wants to search for
post. “KOJO” types in his message and the search result will be what we see in
Screenshot 9 above.
inappropriate comment and finally banning the user from the system. The logic
of flagging a user and banning him/her from the system is represented in
(Figure 9 in Appendix 2) activity diagram of flagging and banning user. The first
inappropriate comment is flagged and administrator will send a warning to the
user. If the user posts inappropriate comment for the second time, the user is
removed from the system and cannot comment again in any future posts.
4.1 Creating Really Simple Syndication (RSS) Feed for the Blog
It is important that the blog has RSS feed in order to tell the outside world
anytime the blog has been updated so that the readers do not have to keep on
coming back to the website to find out if it is updated or not. It is basically an
XML file (index.xml) in Appendix 1. It can be read online through other websites.
Again, it can also be read using news reader software. There are many different
news readers available for all operating systems in recent times.
For sever constraints and other security reasons I would like to create a static
file that is updated only when I make a change to my blog. Traditionally static
files do not need a database connection and my site will be more easily to
handle a lot of inquisitive RSS software.
To create this RSS feed I need to create a new document and name it
index.xml and save it to my root directory and need to edit my operating system
to give it a read-write privileges if it is not a Windows. After writing this code to
write the RSSfile, it is needed to tell the world that you have an RSS feed
(index.xml).
The testing of the blog was tested by fellow colleagues and friends both in
school and at the company. They were to start using the application and give
the outcome. They first did the layout testing and function testing. The results
are those shown based on their feedback.
Google Chrome shows the text too little to see and this could be done by
changing Chrome font-size setting to adhere to font size use in this blog. The
Safari five also shows the text too big in the browser and this could be solved by
changing the font-size setting also here. The rest of the browsers tested almost
all the layout requirements okay and there are no problem using them in those
browsers.
Test Object
6 SUMMARY
It was clear from the project that blogs are becoming powerful way for
individuals and organisations to express their views and share their experience
with others. It is also an easy way for one to share their views on the internet as
compare to going to other medium like newspapers and magazines. It is also
cost effective way of communication as compare to newspapers and
magazines.
The blog homepage or weblog is where the post appear with the seven most
recent ones appearing first and each post selected appear on a separate page
in order to make the reading of the post very easily. This is where the visitor
visits to access the materials in this blog system. The visitors are also able to
read post, search and view achieve posts and comment on entries of their
choice.
The testing area shows the outcome of the test done on the system to see how
the various functions in the works. It was done in the browser to see how it
would look like when in the browser depending on the type of browser. There
are source materials and appendix areas where you see the referencing
materials and tables, figures in the document respectively.
The availability of other blog engines available such as Text pattern, Word
press, Expression Engine, Movable Type and others perhaps there was no
need to build new blog from the scratch but it was done so because of the
requirements of the project. However, it was good way of learning as building
from scratch is more intensive and involves coding by the developer. All the
decisions of the application and building the database were done by the
developer. So it was better way of learning than using pre-made template to do
the blog.
SOURCE MATERIAL
Budd Andy, Collison Simon, Davis J.Chris, Heilemann Michael, Oxton John, Powers David,
Rutter Richard, Sherry Phil. 2006, Blog Design Solutions, USA, Apress Company.
Wetzel, T (2010, October).To Blog or Not to Blog. Rough Notes, 153(10), 62, 64.Consulted.
May 24, 2010, from ABI/INFORM Global. (Document ID: 2164426091).
Appendix 1 continues
</tr>
</table>
</body>
</html>
Appendix 1 continues
<?php
if (isset($_POST['message']) && isset($_POST['title'])) {
if (!isset($_GET['id']) || !is_numeric($_GET['id'])) {
db_insert("insert into blog_post set
created_at='". date ("Y-m-d H:i:s", time()) ."',
title='". db_escape ($_POST['title'])."',
message='". db_escape($_POST['message']) ."'");
echo "<div class=\"success\">A new post was successfully entered <br> <a
href=\"".cfg_web_path."blogs\">Return to blog home page</a></div>\n";
} else {
db_insert("update blogs set
title='". db_escape($_POST['title'])."',
message='". db_escape($_POST['message']) ."'
Where id=". $_GET['id']);
echo "<div class=\"success\">Your post was edited successfully <br> <a
href=\"".cfg_web_path."blog_posts\">Return to blog home page</a></div>\n";
}
require(cfg_path_modules . "footer.php");
}
if (isset($_GET['id']) && is_numeric($_GET['id'])) {
$sql = db_select("select title, message from blog_post where id=". $_GET['id']);
$row = mysql_fetch_assoc($sql);
$lnk = "? id=". $_GET['id'];$title = "Edit post";} else {
$row['title'] = '';
$row['message'] = '';
$lnk = '';
$title = "Write a new post";}?>
<form method="post" action="<?=cfg_web_path?>blogs/write<?=$lnk?>">
<h2><?=$title?></h2>
<table class="form_container">
<tr>
<td class="firstname">Title</td>
<td class="firstinput"><input type="text" name="headline" maxlength="140" class="input_wide"
value="<?=stripslashes($row['headline'])?>"></td></tr><tr>
<td class="firstname" valign="top">Message</td>
<td class="firstinput"><textarea name="message" cols="100" rows="20"
class="textarea_big"><?=stripslashes($row['message'])?></textarea></td></tr><tr>
<td class="firstname"> </td>
<td class="firstinput"><input type="submit" value="Submit" class="input_submit">
<input type="reset" name="Reset" value="Clear">
</td>
</tr>
</table>
</form>
Appendix 1 continues
<?php
include(“../db_connect.php);
$sql= “select blog_post_id, title, message, created_at(postdate, „%e %b %Y at %H:%i) AS
daytime
From blog_post
Order by postdate DESC”;
$result=mysql_query($sql);
$blog_post= mysql_fetch_array($result);?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="english" xml:lang="english" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type"content="text/html; charset=iso-8859-1"/>
<title> Posts posted already-Developers blog</title> </head>
<body>
<h1> Posts posted already</h1>
<?php
if (isset($mesage)){
echo “<p class=‟message‟>”.$message$.”</p>”;}
if($blogpost){echo “<ol>\n”;
do{$blog_post_id=$blogpost[“blog_post_id”];
$title=$blogpost[“$title”];
$daytime= $blogpost[“daytime”];
echo “<li value=‟$blog_post_id‟>”;
echo “<a href=‟blog_post.php?blog_post_id=$blog_post_id‟>$title</a>
posted $daytime”;
echo “</li>\n”;
}
while ($blogpost = mysql_fetch_array($result));
echo”</ol>”;
}
else {
echo “<p> Could not find any entry entered on the website.</p>”;
}
?>
</body>
</html>
Appendix 1 continues
comment_post.php
<form action =”<? =$_SERVER [“PHP_SELF”]?>” method=”POST”>
Appendix 1 continues
delete.php
posted $datetime”;
echo “</li>\n”;
and below is the delete script which should be inserted just after the db_connection code.
if(preg_match(“/^[0-9]+$/”, $blog_post_id))
$result=mysql_query($sql);
if(! $result)
else{
Appendix 1 continues
Table 9: HTML code and PHP code that creates the Blog Home page (index.php)
<?php
include("functions.php");
// Open connection to database
include("db_connect.php");
// will select 7 most recent posts
$sql = "SELECT blog_post_id, title,message, date_time_set(postdate,"Y-m-d\TH:i:s\Z");
AS datetime FROM blog_post ORDER BY postdate DESC LIMIT 7";
$result = mysql_query($sql);
$blogpost = mysql_fetch_array($result);
?>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="css_blog"/>
<title>Developer's Blog</title>
</head>
<body>
<div id="blogcontent">
<div id="blog_post">
<?php
if($blogpost) {
do {
$blog_post_id = $post["blog_post_id"];
$title =
$post["title"];
$post = format($blogpost["message"]);
$datetime = $post["datetime"];
<div id="sidebar">
<div id="about">
<h3>About this</h3>
<p>This is a Developer's blog.</p>
</div>
<?php include("search.php"); ?>
<div id="current">
<h3>current posts</h3>
<?php
mysql_data_seek($result, 0);
$blogpost = mysql_fetch_array($result);
if($blogpost) {
echo "<ul>\n";do {
$blog_post_id = $blogpost["blog_post_id"];
$title = $blogpost["title"];
echo
"<li> <a href='blog_post.php?blog_post_id=$blog_post_id' rel='bookmark'>$title</a></li>\n";
} while ($blogpost = mysql_fetch_array($result));
echo "</ul>";}
?></div>
</div><!-- sidebar div ends here -->
</div><!-- blogcontent div ends here -->
<?php include("footer.php"); ?>
</body>
</html>
Appendix 1 continues
function developersfeed()
//set the file to write
{$filename = $_SERVER[“DOCUMENT_ROOT”] . “/index.xml;
//open file
$fh=@fopen($filename, “w”);
if($fh){$rssfile = ”<rss version=\”2.0\”>
<channel>
<title>Developer‟s Blog</title>
<link>http://www.developers.fi/blog</link>
<description>A blog by Developers Helsinki</description>
<language>en-gb</language>”;
//this pull blogs from the database
$sql=”SELECT blog_post_id,title,message,
DATE_FORMAT(postdate,‟%a,%d,%b %Y %T GMT‟)as created_at
FROM blog_post ORDER by postdate DESC LIMIT 6”;
$result = mysql_query($sql);
if($blogpost = mysql_fetch_array($result)){do {
$blog_post_id = $blogpost[“blog_post_id”];
$created_at = $blogpost[created_at“];
$message = format($blogpost[“message”]);
$title=$blogpost[“title”];
$title=strip_tags($title);
$title=htmlentities($title);
$rssfile .= “ <item>\n”;
$rssfile .= “ <created_at>$ created_at</created_at>\n”;
$rssfile .= “ <title>$title</title>\n”;
$rssfile .= “ <link>http://www.developers.fi/blog_post.php?blog_post_id=$blog_post_id</link>\n”;
$rssfile .= “ <description><![CDATA[$message]]></description>\n”;
$rssfile .= “ </item>\n”;
}while ($blogpost = mysql_fetch_array($result));} $rssfile .=” </channel></rss>”;
//Write to file
$fw=@fwrite($fh, $rssfile);
if (!$fw){
$echomessage = “ Could not write to the file $filename”;}else{$echomessage =”RSS file updated.”;}
//close file
fclose($fh);
}else{
$echomessage=”Could not open file $filename”);
}
return $echo message;
}
<lilinkrel=”alternate” type=”application/rss+xml” title=”RSS 2.0 feed”
href=”http://www.developers.fi/blog/index.xml into just after <title> of my blog homepage
<span class="style2"></span>.
Appendix 1 continues
APPENDIX 1.8 Application Codes
body {
margin: 0;
padding: 0;
}
#blogcontent, #header, #footer {
width:750px;
margin: 0 auto;
}
#header {
height: 152px;
}
#footer {
padding: 15px 0 3 0;
}
#blogcontent {
height: 1%;
overflow: auto;
padding-bottom: 3;
}
#blogposts {
width: 500px;
float: left;
}
#sidebar {
margin-left: 550px;
padding-right: 30px;
}
h1 a {
display: block;
width: 390px;
height: 150px;
text-indent: -1000em;
margin: 0;
}
/* font colours */
body {
font-family:Arial,Verdana,sans-serif;}
;
font-size: 100%;
}
html>body {
font-size: 14px;
}
h1, h2, h3 {
margin: 0;
}
h2 {
font-size: 1.7;
font-weight:normal;
line-height:1;
padding-top: 1;
}
h2 a {
text-decoration:none;
}
#blogposts h3 {
font-weight:normal;
line-height:1;
font-size: 1.5;
margin-top: 1;
}
h4 {
font-weight:normal;
font-style:italic;
line-height:1.5;
font-size: 1.3;
}
.post, dl, #posts UL, #comments P, #results P {
font-size: 1.3;
line-height:1.5;
}
#comments dd p {
font-size: 1;
padding-left: 0;
}
dd {
margin-left: 0;
}
#blogposts h2, #blogposts h3, #blogposts h4, #blogposts h4, .post, DL, #blogposts UL,
#comments P, #results P {
padding-left: 61px;
}
.post p {
margin-top:0;
}
html>body .post p {
margin-bottom: 0;
}
.post P+P {
text-indent: 1.5em;
}
.post {
padding-bottom:1em;
}
#sidebar {
font-size: 1.1em;
line-height: 1.3636em;
}
#sidebar p, #sidebar UL {
margin-left: 16px;
padding-left: 0;
}
#sidebar li {
list-style: disc;
margin-left: 16px;
margin-bottom: 0.70em;
}
#sidebar h3 {
margin:1.46em 0 0.682em 15px;
text-indent: -980em;
overflow: hidden;
}
#sidebar #archive {
text-indent: 0;
}
#archive a {
display:block;
text-indent: -980em;
}
#footer {
text-indent: 62px;
font-size: 1.1em;
}
/* colours */
body {
background: #A0522D repeat fixed center;
color: #CD5C5C;
}
A{
color:#ADFF2F;
}
H2 A {
color: #000000;
}
.post {
background: no-repeat left 3px;
}
#header {
background: #800000 no-repeat;
color: #fff;
}
#footer {
background: no-repeat;
}
#blogcontent {
background: #FFFFFF repeat-y fixed center 111px;
color: #000000;
}
#about h3 {
background: no-repeat;
width: 141px;
height: 19px;
}
#search {
background: no-repeat;
width: 57px;
height: 16px;
}
#current h3 {
background: no-repeat;
width: 135px;
height: 20px;
}
#archive {
background: no-repeat ;
width: 128px;
height: 15px;
}
#addcomment h3 {
background: no-repeat ;
width: 120px;
height: 15px;
}
/* Forms */
input, textarea {
border-width: 1px;
}
input[type=text], textarea {
width: 160px;
}
input, textarea {
font-size:1;
}
Appendix 1 continues
APPENDIX 1.9 Application Codes
Table 12: Blog Home Pages (HTML)
</head>
<body>
<div id="sidebar">
<div id="about">
<h2>About Developers</h2>
</div>
<h3 id="search">Search</h3><p>
</p></form>
</div>
</div>
</div>
Appendix 1 continues
header.php
<div id="header">
<h1><a href="index.php">Developers Blog</a></h1>
</div>
footer.php
<div id="footer">
<p>A blog by Developers Helsinki oy.</p>
</div>
Appendix 2
Triggering Event: Unregistered User selects blog website Account Creation Form
Not registered user selects registration form on blog website. Not registered
Brief Description: user inputs his/her information require by the form. Once user submits form,
system will check for errors in form. If successful, system will send out a
confirmation email, which the user must respond to. If unsuccessful, system
will require user to input his/her account information again. Once user
responds to confirmation email, the user becomes a registered user who is
allowed to comment on post, search for post and enjoy most aspect of the
system
Pre-conditions: Not registered user must exist., Account creation system must exist
Post-Conditions: 1. Account must be created. 2. User must be able to log into blog website.
3.User must have account privileges that are assigned for registered users
3. Not registered user submits 3.1 System checks for errors and required
completed form fields.
Exception 3.1 If unregistered user inputs an invalid username, email, or password, then
Conditions: unregistered user must choose a new one.
3.2 If unregistered user closes form window, then system does not register or
store any information input by the user.
5.1 If unregistered user does not receive confirmation email, then user can
request confirmation email to be resent by attempting to log in
Appendix 2
blog
Display Account Creation
Form
Selects Account Creation
Form
Errors in
Form? Yes
blog
Administrator System
blog
Display Keyword Search
comment Page
Access Keyword Search
Comment Page
Submit
Does registered
User‟s account
No
Have 2 Flags?
Yes
blog