Blog Design Solutions (2006)
.pdf
B L O G D E S I G N S O L U T I O N S
Migrating your files
Next it’s time to copy your files across. Edit db_connect.php so it has the correct username and password for your live database. Now open up your FTP software, connect to your web server, and copy the rest of your files and folders into the public_html folder. Check that your index.xml RSS file is read-writeable, as explained earlier.
Finally, you need to password-protect your cms folder. This process will vary from ISP to ISP, but you will usually be provided with an Apache web control panel, which enables you to password-protect directories as well as a whole host of other operations (see Figure 7-26).
Figure 7-26. Adding password protection using the Apache console
And that’s it: you exported and uploaded your entire MySQL blog database, transferred all your files to your public-facing website, and password-protected your CMS. Your blog is now live and awaiting posts and readers.
The future
The great thing about having your own blog engine is that you can keep improving it as you discover more techniques and cool stuff to add. I’ll now discuss a few additions you could make to your blog by using the knowledge you have already gained.
Flickr
Flickr (www.flickr.com) is a fantastic photo-sharing site in which you can upload and share photographs, and—what’s more—basic registration is free. Flickr provides a number of ways to display your photos on sites other than Flickr, and what better place to show them than your blog? The quickest and easiest way is to use the Flickr badge JavaScript or Flash code. Once you are signed up, you can go to www.flickr.com/badge.gne, follow the instructions, and cut and paste the code into your blog—the ideal place is the sidebar of your homepage.
336
W R I T E Y O U R O W N B L O G E N G I N E
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 func-
tion from www.textism.com/tools/textile/license.html. You can use it to replace the 7 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 format- ting—for example, *this* would place <strong> 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!
337
I N D E X
I N D E X
Symbols
& (ampersand), 181 // (double slash), 279
! (exclamation mark), 195 ; (semicolon), 31, 279
_ (underscore), 279
A
about page, 134 #about_site id, 164–165 about template, 152 Acronym plug-in, 169 ActiveRefresh, 10
addslashes function, 281, 315 admin area, TxP, 229–231
diagnostics, 229–230 preferences, 230–231
administration site building, 278–297
creating screen for adding posts, 278–285 creating screen for listing posts, 292–294 creating screen for updating posts, 285–291 deleting blog sites, 294–295
navigation, 295
schematic diagram of, 278 stylesheet for, 296–297
AGAINST function, 328 aggregators, 9
all-in-one software packages, 22 Allen, Dean, 216–217 ampersand (&), 181
Apache, 8, 23
choosing port for, 24 closing, 37
configuring, to use CGI scripts, 40–41, 59–60 configuring, to work with PHP, 33–38 disabling, 28
downloading and installing, 24–28 installing on Windows, 23–28 removing existing installation of, 24–25 starting and stopping, 28, 52–53 startup preferences, 28
test configuration, 37 using on Mac OS X, 51–53
Apache Services Monitor, 28 archive code, 265–267 archives
adding link for, 254–255
category and data-based, 108–110 creating, 261, 318–324
archives.php, 192–193 articles. See blog posts Auf der Maur, Melissa, 4
B
background images, default CSS, 156–158 backups, 174–175
Baghdad Blogger, 3 BBEdit, 51
Binary Bonsai, 172
blog databases. See databases blog design
changing header attributes, 155 conditional tags, 187–188
with CSS, 92–94, 152–168, 183–184 design creation, 90–92
drop shadows, 100–101 HTML and, 183–184 include tags, 188–189 inspiration for, 87–89 layout and styling, 94–98 in Movable Type, 87–92 planning phase, 87
template structure, 184–185 template tags, 185–187 with TxP, 233–238
with WordPress, 183–189 blog engines
adding comments, 312–317 archive creation, 318–324 creating RSS feed, 329–334
creation management system (CMS), 274–277 migrating to live environment, 334–336
#blog id, 164–165 blog posts
adding, 146, 278–285 advanced formatting, 337
allowing for content length in, 250, 252 automatically formatting, 306–307 categorizing, 337
creating post page, 310–312 deleting, 294–295
displaying, in WordPress, 180–181 displaying, on homepage, 305–306 numbering, 295
previews, 337
screen for listing, 292–294 screen for updating, 285–291 storage of, 19
TxP, 247–249
blog technologies, 19
see also specific technologies blog/more template, 144–145 Blogger, 6
blogging
in 2004, 5 options, 5–7 overview, 3–5
340
