Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- <!-- This is the main entry into the Object Orientated Blog site
- in PHP. It requires two file paths: the first is a folder
- called css in which the cascading style sheet should be placed,
- and should be named style.css. In the directory libraries,
- blogPost.php, dateClass.php and include.php should be put there.
- Finally, you'll need to link to your own database, so some of the
- code will need modifying here. The connection is accessed through
- the $blogPost object, see below.
- This project is based on a tutorial by Ben Mills. Please see
- net.tutsplus.com/tutorials/php/how-to-create-an-object-oriented-blog-using-php/
- for further explanations.
- @Author: Shaun B
- @Date: 2012-10-24
- @Todo: Further functionality is needed to the site, such as adding entries
- to the blog, adding users and therefore signing in to edit and
- removing various posts linked to the user.
- -->
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
- <head>
- <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" title="Blogging" charset="utf-8">
- <title>A Simple Blog example</title>
- </head>
- <body>
- <div id="main">
- <h1>My Simple Blog</h1>
- <div id="blogPosts">
- <?php
- include ("libraries/include.php");
- $blogPosts = new blogs();
- // The parameters to send to $blogPost->connect are ( server, username, password, database name )
- $blogPosts->connect( 'localhost', 'root', '', 'blog');
- foreach ($blogPosts->GetBlogPosts() as $post) {
- echo "<div class='post'>";
- echo "<h2>" . $post->title . "</h2>";
- echo "<p>" . $post->post . "<br />";
- echo "<span class='footer'>Posted By: " . $post->author . " Website: " . $post->url ." Posted On: " . $post->datePosted . " Tags: " . $post->tags . ".</span></p>";
- echo "</div>";
- }
- ?>
- </div>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement