onI couldn't think of what I should do for Christmas. A story? A picture? A song? An extremely complicated article about how to implement something, such as the MetaWeblog API? No.
Then I thought of it. I could lie and attribute it to Gryphic's Christmas Stories prompts and say the line "We can't be the only ones to celebrate Christmas. How do aliens/fictional characters/animals celebrate?" inspired me to do this, but that's not exactly true as I did this two days before Gryphic wrote that post.
I've been wanting to bring KFM back for a while now and thought that while I'm pondering that situation, I'll post one more KFM comic. I give to you "'Twas The Night Before Kirbymas":
And, because I feel like doing what Gryphic often does, I'm going to post a song. It's called Do They Know It's Christmas Time by Band Aid and it's featured in the previous KFM comic:
It's Christmas time, and there's no need to be afraid At Christmas time, we let in light and we banish shade And in our world of plenty, we can spread a smile of joy Throw your arms around the world at Christmas time
But say a prayer to pray for the other ones At Christmas time, it's hard, but when you're having fun There's a world outside your window And it's a world of dread and fear Where the only water flowing is the bitter sting of tears And the Christmas bells that ring there Are the clanging chimes of doom Well, tonight, thank God it's them instead of you
And there won't be snow in Africa this Christmas time The greatest gift they'll get this year is life Where nothing ever grows, no rain or rivers flow Do they know it's Christmas time at all?
Here's to you, raise a glass for everyone Here's to them underneath that burning sun Do they know it's Christmas time at all?
Feed the world Feed the world
Feed the world; let them know it's Christmas time And feed the world; let them know it's Christmas time And feed the world; let them know it's Christmas time And feed the world; let them know it's Christmas time
Band Aid
Merry Christmas!
Blog posts tagged "holiday"
onThis post was inspired by Gryphic's Christmas Stories prompt "What is the true meaning of Christmas? Love, presents, or just plain celebration?*"
As of this, this is not a true story, but actually a fictitious, short story.*
Tamara looked out the window at the billowy, white snow that covered everything the eye could see. Though she and her family were snowed in their house for a few days, tomorrow was Christmas. And the snow hadn't knocked out their Internet connection.
Tamara remembered back to a month ago when she sat, writing her Christmas list. It was full of "wants" and "needs" and "retroactive lollipop machines". She couldn't wait for those things to arrive. At the time, anyway.
Now, however, she thought differently. It wasn't some magical leaf turnover like in A Christmas Carol, but she was actually starting to think that there could be a meaning of Christmas further than material happiness.
The many family reunions they had gone to within the last week had prooved that, if anything. But the thing that had done the magic was the snow. The snow that had trapped her and her family in her house for half a week (according to the weatherman).
Without anywhere to go, she spent most of her time with her family. It was actually fun. Everyone was being joyful and happy, not at all upset that they couldn't go and buy more EggNog.
With Christmas fast approaching tomorrow, she knew that, over the presents, her family would actually mean something this year. And that is the true meaning of Christmas.
onYou must be looking at this post and thinking, "Ok, what?" Yes, probably. I really don't know.
Anyway, this is just a rant. And it's about my iPod. It's a new (well, two months new) Chromatic (yellow and pretty) and works pretty well. However, randomly, during arbitrary songs, the music will suddenly STOP.
And then, you know you have to hurry if you want to keep listening to that song. When that happens, I have to rip the headphones off of my ears and unlock (take out of HOLD) the iPod. At that moment, the iPod will make a very loud noise. So loud, you can hear it quite clearly even without the headphones on. "Oh, goodness," you should think to yourself, "I just saved my eardrums."
Immediatly after I do that, the music starts playing and the pause button doesn't respond for a few seconds so I miss some of the song. :( This is really annoying, and I don't know why it happens. Does anyone know? Knowing Apple, is it a feature or a bug? :)
Anyway, yes, you can say it.
"Ok, what?"
onYAY! People seem to be much more interested in Kirby Week this year! :)
YES! - 6 vote(s)! No. - 3 vote(s)! Maybe.... I haven't decided.... - 2 vote(s)! What on earth is Kirby Week? - 0 vote(s)!
Well, thus ends Kirby Week 2008. I hope you've all had fun! And, yay, I messed up yesterday! Stupid me!
It's nearly Christmas, so don't be sad, only a few more days until we're all glad. (That was a terrible rhyme)
onUm.... not really. Just trying out another Nonsense script! Well, I guess it's the teensiest bit relevant because Four Island went down.
Don't blame Linux you peoples! It was actually my fault. Yesterday, frustrated with Debian's.... um.... not-up-to-datedness-with-packages thing, I stupidly added the Ubuntu APT repository to
/etc/apt/sources.list
.... and tried tosudo apt-get upgrade
. Oops.The upgrade broke halfway done because it tried to install a package that used "Breaks", which Debian's old
dpkg
couldn't handle. So I was left with a mutant system, half Debian, half Ubuntu, completely unstable. I was afraid that if I turned it off, it'd never turn on again.Exasperated, I backed up all of the data, downloaded Ubuntu 8.10 Server Edition, installed it and here we are! Four Island is back and better than ever! Ubuntu always used to work for me before I got a dedicated server and it seems to be working fine now.
And yes, I am a lazy person to the extreme. I'm sorry to everyone that I forgot to write the final article of Kirby Week 2008 :(. So instead, I'm just going to redirect you to a previous article.
I wrote an article entitled How To Implement Pingback a while back (in fact, on June 17th 2008, though since I changed time zones it says June 16th) that explains how to implement Pingback on your blog. You should do that because Pingback is a very useful thingy and I'm crazy about it. :)
And to end off, I'm going to include a few more results from that Nonsense script I mentioned:
Tamasys destroyed Color Pencils W. B. Sarel thinks Wikipinia is thick sticky The Fourm is taken over by Chofox Hudper Tamasys wants to have plagurized Smiley Four Island is parodied by Color Pencils
The last one is disturbing as Gryphic (or Drifty, as she now calls herself) actually has done this. :) However, she's purged all articles on her site before Four Island finished its extended downtime, so I can't link to it. Sorry! :)
onOn the fifth day of Kirby Week, Four Island gave to me: An way of making URLs look prettier.
As I promised yesterday, today I'll be showing you how to use prettier URLs to reference your blog posts. We'll be removing the query string.
In this tutorial, I'm assuming you're using the Apache web server with mod_rewrite enabled. Otherwise, you'll probably need to read more elsewhere when we get up to the
.htaccess
file.Speaking of the
.htaccess
file, let's do that now. In yourkirbyweek08
folder, create a file called.htaccess
and put this in it:RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule (.*)/ read.php?slug=$1 [L]
Well, that's yummy-yay-yay, but the
read.php
file does not yet accept aslug
parameter. Let's add that functionality now with an upgrade to theread.php
file. Find the line that says:$getpost = "SELECT * FROM posts WHERE id = " . $_GET['id'];
Replace it with the following:
if (isset($_GET['id'])) { $getpost = "SELECT * FROM posts WHERE id = "; $getpost .= $_GET['id']; } else if (isset($_GET['slug'])) { $getpost = "SELECT * FROM posts WHERE slug = \""; $getpost .= $_GET['slug'] . "\""; }
This will allow
read.php
to parse slugged URLs. Now that Prettiful URL support has been added, you think you're done, right? Wrong. We have to fix the links toread.php
infunctions.php
andrss.php
.Within
functions.php
, there are two occurances of this partial line of code:<A HREF="read.php?id=<?php echo($sqlOutput['id']); ?>">
Replace both with:
<A HREF="http://example.org/kirbyweek08/<?php echo($sqlOutput['slug']); ?>/">
Of couse, remember to replace
http://example.org/kirbyweek08/
with the path to your blog.In addition, the following partial line of code appears in
rss.php
:/read.php?id=<?php echo($getposts3[$i]['id']); ?></link>
Replace it with:
/<?php echo($getposts3[$i]['slug']); ?>/</link>
And there! You're done! You've added prettiful URL support to your blog! YAY!
Tomorrow we'll be discussing other small improvements you can make to your homebrew blogging system.
onOn the fourth day of Kirby Week, Four Island gave to me: An article about implementing RSS.
It's another day of Kirby Week which means another tutorial! Today's post will be short because there's not that much to dynamically creating an RSS feed. What's that, you say? You don't know what RSS is? Le gaspez!
RSS stands for Really Simple Syndication. It provides a list of your latest blog posts (or anything, really, RSS can also be used nicely for things such as comments) in a format computers can read. This way, a computer can more easily tell if you publish a new blog post, for instance, and notify anyone who wishes to be notified.
RSS is an XML specification, so the entire thing is based upon a system of tags. Let's get to writing it!
Create an
rss.php
file in yourkirbyweek08
folder. The root tag is the<rss>
tag, with a mandatory attribute (version
) that has to be set to2.0
. So, our document current looks like this:<rss version="2.0"> </rss>
Every RSS feed has to contain a
<channel>
tag with information about the feed in question. Let's populate it with some default data that you can change:<rss version="2.0"> <channel> <title>Kirby Week 2008</title> <link>http://example.org/kirbyweek08/</link> <description>A description! YAY!</description> </channel> </rss>
The fields introduced above should be pretty self-explanatory. The next thing to do is to dynamically introduce the latest 10 blog posts into the
<channel>
tag. I've done that here: http://other.fourisland.com/kirbyweek08/?source=rss.php. Ensure you replace all instances ofhttp://example.org/kirbyweek08/
in the code with the path to your blog.So, now you've got a feed. That's great, however, people probably won't know its there. Open up your custom
header.php
file. Somewhere between your<HEAD>
tags, add this snippet of HTML:<LINK REL="alternate" TYPE="application/rss+xml" HREF="rss.php" />
Now that you have an RSS feed, there are other options to consider, such as using a service like Feed Burner to "burn" your feed. Feed Burner can track subscribers, links clicked on, suspicious uses and other things, for instance, making your feed look prettier with little widgets at the bottom of each post.
Currently, the URLs we use to access each of your blog posts are kind of ugly (they all contain
read.php?id=
). Tomorrow we'll focus on removing the query string from the blog post URLs.
onOn the third day of Kirby Week, Four Island gave to me: An article about using IntenseDebate.
Welcome back! Yesterday, I promised I'd show you how to add a commenting system to your blog. And I will! But, being the lazy person I am, I'm not going to show you how to write one. Instead, we'll be using Automattic's IntenseDebate.
IntenseDebate is a good commenting system by the makers of Wordpress. Yes. Ok. Anyway, it has lots of prettiful features that it enumerates all over its site so you should go read it.
IntenseDebate is pretty easy to get started with. Simply go to its website, register for an account, and add a blog. When it asks you what type of blog you have, choose "Custom" or "Generic". It'll provide you with two Javascript snippets.
We're nearly done! Already! Take the first snippet and paste it in
read.php
, after the call todisplayPost()
but before the inclusion offooter.php
. There! You're done! That was easy!If you want to change your settings, moderate comments or anything, simply log in at the IntenseDebate website and you're dashboard is your friend!
Tomorrow, we'll be adding RSS support to your blog so people can receive notification and other fun stuffses.
onOn the second day of Kirby Week, Four Island gave to me: A tutorial on coding an admin panel.
Welcome back to the second day of Kirby Week! As I told you yesterday, today's post is about writing an Admin Panel! Yay! We're going to only create a very basic panel: Single user login and when you get there, all you can do is write posts.
We'll be storing the single user in the database for some deranged reason. Possibly later we'll add multi-user support, I don't know. Anyway, here's the schema for the users table:
CREATE TABLE `users` ( `id` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY , `username` VARCHAR( 255 ) NOT NULL , `password` VARCHAR( 255 ) NOT NULL DEFAULT '' );
And remember to add a user to the users table!
First, you need a login form. I'll let you handle this as, I assume, if you're writing a blog you probably know something or other about HTML. It should POST to
admin.php
and contain Username (NAME="username"
) and Password (NAME="password"
) fields.Finish the form? Good. Now, we need to write the back end. Create a file called
admin.php
and put this in it: http://other.fourisland.com/kirbyweek08/?source=admin.php.Since I don't want to do all of the work, I'm going to let you design another form! YAY. Between the two comments (
[/code]), create a form that
POSTs to
admin.php?submit=. Create a textbox in it
NAMEd
title, a textarea
NAMEd
textand another textbox
NAMEd
tags`. Obviously, also put in a submit button.You may want to label the elements so you know what to do while posting. The first is the Title of the post, the second is the content, and the third is the comma-delimited list of tags for the post.
YAYish, I guess. We're done with the Admin panel.... Sort of. The admin panel is currently annoying, you have to type in all of your formatting and such using HTML. We'll fix that with a handy JavaScript editor called TinyMCE.
Download TinyMCE from the aforementioned link, extract it and plop the
jscripts/tiny_mce
folder into yourkirbyweek08
folder. Now, let's add TinyMCE to our admin panel. Append this code above yourFORM
.Hurray! If everything went right, your admin panel should now be better looking and easier to use! Remember that this is just a basic model and you should really style it and add more functionality on your own.
Next time, we'll be adding commenting system to your blog so people have the chance to talk about the wonderful things you're blogging about.
), create a form that
POSTs to
admin.php?submit=. Create a textbox in it
NAMEd
title, a textarea
NAMEd
textand another textbox
NAMEd
tags`. Obviously, also put in a submit button.You may want to label the elements so you know what to do while posting. The first is the Title of the post, the second is the content, and the third is the comma-delimited list of tags for the post.
YAYish, I guess. We're done with the Admin panel.... Sort of. The admin panel is currently annoying, you have to type in all of your formatting and such using HTML. We'll fix that with a handy JavaScript editor called TinyMCE.
Download TinyMCE from the aforementioned link, extract it and plop the
jscripts/tiny_mce
folder into yourkirbyweek08
folder. Now, let's add TinyMCE to our admin panel. Append this code above yourFORM
.Hurray! If everything went right, your admin panel should now be better looking and easier to use! Remember that this is just a basic model and you should really style it and add more functionality on your own.
Next time, we'll be adding commenting system to your blog so people have the chance to talk about the wonderful things you're blogging about.
onOn the first day of Kirby Week, Four Island gave to me: A tutorial on coding a blogging engine.
Welcome to Kirby Week 2008. As I told you yesterday, I'm going to spend this week teaching you how to write your own blogging engine. As we go along, we'll be adding many enhancements and such, but for now, we'll be starting with the basics. The blog you will be building will be loosely based on the SimpleBlog engine.
To do this tutorial, you, of course, need:
- A Web Server
- PHP
- MySQL
We'll start with creating the base directory structure. In your webroot, create a folder called kirbyweek08. Create a css folder inside that folder.
Next, we need to set up the database. Create a new database called "kirbyweek08" and use this schema to create the tables:
CREATE TABLE `posts` ( `id` int(11) NOT NULL auto_increment, `title` varchar(255) NOT NULL, `text` text NOT NULL, `slug` varchar(255) NOT NULL, `pubDate` timestamp NOT NULL default CURRENT_TIMESTAMP, `tags` varchar(255) NOT NULL, PRIMARY KEY (`id`) );
We need to let your site connect to the database. So, create a
db.php
in the kirbyweek08 folder, and put this in it:<?php $dbwebhost = 'localhost'; $dbwebuser = 'root'; $dbwebpasswd = ''; $dbwebname = 'kirbyweek08'; mysql_connect($dbwebhost, $dbwebuser, $dbwebpasswd); mysql_select_db($dbwebname); ?>
$dbwebhost
and$dbwebname
are probably correct for you, but swap in the correct values for$dbwebuser
and$dbwebpasswd
(a.k.a. username and password of someone with permission to access and modify the kirbyweek08 database). Now that that's done, we can start making the blog.Create an
index.php
file in your kirbyweek08 folder, and put this in it:<?php require_once('db.php'); require_once('functions.php'); include('header.php'); $getposts = "SELECT * FROM posts LIMIT 0,4"; $getposts2 = mysql_query($getposts); $i=0; while ($getposts3[$i] = mysql_fetch_array($getposts2)) { displayPost($getposts3[$i],true); $i++; } include('footer.php'); ?>
A little explanation is required here. First, this file connects to the database by loading the
db.php
file we created before. Second, it loads a file calledfunctions.php
that we haven't created yet, and a file calledheader.php
that we also haven't created yet. These files will contain useful functions reused often in your code, and a header to display above every file, respectively.Next, the file downloads the latest four posts from your database and uses a function called
displayPost()
to display it. Finally, it loads a non-existent file calledfooter.php
which will contain a footer.The most important part is the
displayPost()
function. It will lie in thefunctions.php
file. Instead of posting the code, I'm just going to link to it because it's rather long and it goes off of the side of the post.Wow! That was a lot. Don't worry, that's the longest code snippet in this application. Whew. I think it's time for testing. However, if we test it now, there'll be nothing to see. First, add a record to the posts database.
The fields are simple. Ignore
id
andpubDate
, they're automatically generated by MySQL.title
andtext
should be self-explanatory.tags
is a comma-deliminated list of tags for the post. Now we can test it.You should see your post, surrounded by tons of errors. Oops. We forgot to make the header and footer! Also, you'll notice that it's saying your post is by "Anonymous". Want to fix that? Notice at the top of
functions.php
, a variable named$author
. Set that to your username and you're set.Let's create that header. Basically, you can put whatever you like in it. Just remember that it is pasted above the contents of every file, so make sure that a
<BODY>
tag has been opened by the time the file ends. Use this as an opportunity to theme this new blog with the rest of your site! Follow suit withfooter.php
as well, it's just a footer.Nearly done! Now, all we have to do is create the other two files linked to by the
displayPost()
function. Here'sread.php
:<?php require_once('db.php'); require_once('functions.php'); include('header.php'); $getpost = "SELECT * FROM posts WHERE id = " . $_GET['id']; $getpost2 = mysql_query($getpost); $getpost3 = mysql_fetch_array($getpost2); displayPost($getpost3, false); include('footer.php'); ?>
And
tag.php
:<?php require_once('db.php'); require_once('functions.php'); include('header.php'); $getposts = "SELECT * FROM posts WHERE tags LIKE \"%" . $_GET['tag'] . "%\" LIMIT 0,4"; $getposts2 = mysql_query($getposts); $i=0; while ($getposts3[$i] = mysql_fetch_array($getposts2)) { displayPost($getposts3[$i],true); $i++; } include('footer.php'); ?>
We'll, we're pretty much done! I know, I know, it's mediocre. Don't worry, during this week we'll really spruce it up. Thank you for surviving that long tutorial, the rest is more fun.
You'll have noticed that there's no way you can post to this blog short of manually editing the database. Tomorrow we'll be looking at creating an admin panel for you to use for your bloggy funness. Enjoy!