WRITE YOUR OWN BLOG ENGINE Post and comment (Post office web site)

WRITE YOUR OWN BLOG ENGINE Post and comment previews You can provide a preview of a post in your Administration site. To do this, add a Preview button next to Add post or Update post. Use logic, such as case switching, so your script can detect which button has been pressed and then know whether to update the database or display a preview of the form submission on the page. Adding previews for comments is another good idea because it gives your readers a chance to ensure that their comment will look like they expect. If you force readers to preview their post first by showing the Post button only in preview mode, this can help fend off comment spam (in itself, having your own blog engine goes a long way toward preventing comment spam). Advanced formatting of posts As it stands, your posts are only automatically formatted with paragraph and line break tags; any other formatting you require needs to be added as HTML within the post. Luckily, there are some free alternatives available to help speed up your post writing and format your blog more beautifully. Textile is used within TextPattern (see Chapter 5) and is also available as a separate function from www.textism.com/tools/textile/license.html. You can use it to replace the format function in the functions.php include file. Textile automatically adds paragraphs and line breaks, automatically links URLs, and has its own simple language for formatting for example, *this* would place tags around the word this. Markdown, which is similar to Textile, is available as a PHP function from www.michelf.com/ projects/php-markdown/. Markdown has some differences from Textile because it converts e-mail style language into HTML. For more information on Markdown, see daringfireball.net/projects/markdown/. Categorizing your posts A slightly more advanced addition is to add a categorization system for your blog posts, which would involve creating a categories table with the names of your categories and a category_id for each. Then, in the same way in which you included a post_id field in the comments table so that you knew which post each comment referred to, so you could add a category_id field to the posts table so you know which category each post is in. You would probably also want to add a Categories section to your CMS to help add and edit categories, as well as a post archive page for each category. Happy blogging You should now have a fully functioning content management system and blogging engine, complete with comments, search engine, and a whole bunch of ideas for new features. But what your blog really needs is some content, so pick a subject, get writing, and enjoy yourself!

WordPress database error: [Table 'armadillowebhosting_com_-_apache.wp_comments' doesn't exist]
SELECT * FROM wp_comments WHERE comment_post_ID = '408' AND comment_approved = '1' ORDER BY comment_date

Leave a Reply