10.2. Adding Posts

Figure 10-1 shows the form with a new post entry.

Figure 10-1. Figure 10-1

The admin page will be where the blog author will enter his posts. The 401.php file should be included at the start of it since the functionality of this page should only be allowed to the author after he's identified himself by logging in.

The page initially displays a list of available blog posts in a select control, although over time the number of posts will undoubtedly grow and presenting them this way may become cumbersome. You may want to consider listing them some other way — perhaps by first narrowing the list by month or year or as a data grid similar to the one I presented in the file manager project. Then the form through which the blogger will enter his post should offer fields to enter the post's date, title, and main content. Two third-party components are used in the form, a rich text edit box and a pop-up calendar component.

The edit box used is TinyMCE and is available from http://tinymce.moxiecode.com under the GNU Lesser Public License, which means you can freely use it in your applications. TinyMCE is popular for its ease of integration. After uploading the control's code to the server, just a little bit of JavaScript can be added to the top of a page and any HTML textarea can be converted into a rich text editor. The minimal amount of code required for pulling in ...

Get PHP and MySQL®: Create-Modify-Reuse now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.