Blog posts tagged "kirbyweek"

Um.... 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 to sudo 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! :)

Hatkirby on December 19th, 2008 at 5:41:54pm
πŸ‘ 1 πŸ‘Ž

On 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 your kirbyweek08 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 a slug parameter. Let's add that functionality now with an upgrade to the read.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 to read.php in functions.php and rss.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.

Hatkirby on December 18th, 2008 at 12:30:25pm
πŸ‘ 3 πŸ‘Ž

On 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 your kirbyweek08 folder. The root tag is the <rss> tag, with a mandatory attribute (version) that has to be set to 2.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 of http://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.

Hatkirby on December 17th, 2008 at 12:38:32pm
πŸ‘ 3 πŸ‘Ž

On 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 to displayPost() but before the inclusion of footer.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.

Hatkirby on December 16th, 2008 at 12:31:02pm
πŸ‘ -1 πŸ‘Ž

On 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 thatPOSTs toadmin.php?submit=. Create a textbox in itNAMEdtitle, a textareaNAMEdtextand another textboxNAMEdtags`. 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 your kirbyweek08 folder. Now, let's add TinyMCE to our admin panel. Append this code above your FORM.

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 thatPOSTs toadmin.php?submit=. Create a textbox in itNAMEdtitle, a textareaNAMEdtextand another textboxNAMEdtags`. 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 your kirbyweek08 folder. Now, let's add TinyMCE to our admin panel. Append this code above your FORM.

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.

Hatkirby on December 15th, 2008 at 12:31:54pm
πŸ‘ 3 πŸ‘Ž

On 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 called functions.php that we haven't created yet, and a file called header.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 called footer.php which will contain a footer.

The most important part is the displayPost() function. It will lie in the functions.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 and pubDate, they're automatically generated by MySQL. title and text 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 with footer.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's read.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!

Hatkirby on December 14th, 2008 at 12:32:13pm
πŸ‘ 7 πŸ‘Ž

I'm glad to see many "I LOVE ITs" for TGS, because it's such a great project. For you who don't know what it is, see this: The Greatest Story.

I LOVE IT. - 9 vote(s)! It's an interesting idea. - 0 vote(s)! What the negative is it? - 2 vote(s)! **** - 0 vote(s)!

I'm sure you all know, Kirby Week 2008 starts today! For those who don't know, Kirby Week is the third week of advent, when the candle is pink. Yes, I know, that wasn't funny. :)

I started the strange idea of Kirby Week in December 2006, a year before Four Island even existed. Since then, each Kirby Week has been a week of fun, joy and excitement at the holiday to come. Starting this year, I'd also like to do something for Four Island during Kirby Week.

I've decided that during Kirby Week, I shall post a weekly special (like VisitorGrid Week) on a set topic. Sound like fun? I hope it does!

This year's topic is how to code your own blog. TimTam has been nagging me to do this anyway, so I might as well use it for Kirby Week!

And also, I've decided to do use last year's Kirby Week poll for this year as well. So, all in all, I hope you all enjoy Kirby Week 2008!

Hatkirby on December 13th, 2008 at 10:55:33am
πŸ‘ 0 πŸ‘Ž

Thumbnail2The Fourm* is here.....

I've created a fourm for the website. You can go to it, register for free, and post what you want. Please, do so, PLEASE!!!!

Oops, sorry about that. But I'm really excited about The Fourm. Look at the above screenshot. Anyway, please go and try it! I bet it will be a wonderful way to converse and yes...

*NOTE: I am saying Fourm on purpose. On the Fourm, you are supposed to say Fourm not forum. (Four, get it?)

Hatkirby on March 30th, 2008 at 6:22:42am
πŸ‘ 4 πŸ‘Ž

Well people, it's official. Kirby Week is over. Let's all start with four seconds of silence so we can remember the joy of this week.

OK. In other news, although Kirby Week is over, there is another holiday tomorrow! And I'm sure you know what it is!

Hatkirby on December 23rd, 2007 at 8:39:18am
πŸ‘ 2 πŸ‘Ž

Oooh! 12 voteeessssssss!!!!!!!!

YES! - 10 vote(s)! Mmmm... it's OK... - 2 vote(s)! NO WAY! - 0 vote(s)! What did the old one look like? - 0 vote(s)!

I hope you will all vote this time!

NOTE: Today's the last day of Kirby Week!!!!!!!!!!!!!! NOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO!!!!!!!!!!!!!!!!!!!!!!!!

Hatkirby on December 22nd, 2007 at 7:36:56am
πŸ‘ 1 πŸ‘Ž