Advertisement
Shaun_B

index.php file for simple blog

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