The Grotblog config file (Blog Software)

Paul M. Foster (22 December 2010 20:35:58)

Okay, first things first. Let's look at the configuration file for grotblog. This will be a file in the config directory called config.ini. Since there are built-in facilities in PHP for reading ini files, we might as well use them. Here we go:

programmer_email = "paulf@sherman.mars.lan"

Item the first, the programmer writing this software. Why put this in the config file? Because our error handler will be set to email the programmer will details if a fatal error occurs.

site_prefix = "http://pokey/grotblog/"

Next is the URL which goes in front of any link which needs it.

session_name = "noferblatz"

This is how we will identify sessions in our session cookies.

blog_url = "http://pokey/grotblog/index.php"

The main page of the blog. This is what anyone coming to the site for the first time sees. It's not the front controller.

blog_title = "Writing, Coding & Life"

This will show up at the top of all the pages.

 blog_owner = "noferblatz"

This is who owns this dang thing. If you go to someone's blog, you want to know whose opinions you're looking at, right?

blog_language = "en"

Although I have no provisions for using anything other than English, we might as well get it straight from the outset.

posts_per_pg = 5

An all-important setting for blogs-- how many posts do we want to show on each page?

post_upload = 1

My intention is primarily to upload posts to this blog. But at some point later on, someone might whine loud enough that I feel the need to add the capability to edit posts in the software. This setting merely determines whether we will allow people to upload their blog posts. (Watch: someone will get hold of this and decide they can use their favorite editing software-- Microsoft Word-- to edit their posts, and upload the posts as is. I can only imagine what that will look like.)

prefer_excerpts = 1

I don't want to show full blog posts on the main pages. I want to show excerpts instead. This setting determines whether we show excerpts or the full posts.

excerpt_chars = 200

My intention is for the user to type in an actual excerpt, separate from the post itself. However, if they don't or don't want to, this setting determines how the system will create its own excerpt. In our case, it will snag the first 200 characters to create the excerpt.

posts_chrono = 0

Another common blog setting. Do we want posts in chronological order, or in reverse order. My default is to show them in reverse chronological order, so the latest appears at the top. Hence I set this to 0, which means not in chronological order.

comments_chrono = 1

As above, but for comments. I think they should be chronological order. Hence my default of 1 (true).

trackbacks_chrono = 1

I don't have plans to add trackbacks early on, but we should include this just in case.

comments_allowed = 1

This is a true default setting. It means that, by default, comments are to be allowed on all posts. The author can decline this for any given post, but the default will be to allow them.

trackbacks_allowed = 0

As above, but for trackbacks.

blacklist_enabled = 1

I have no doubt that some idiots will show up who insist on spewing nonsense. This allows us to put them in a blacklist and prevent them from commenting.

allowed_tags =

These are the main tags we will allow in comments. Any tags beyond this will be expunged.

charset = "UTF-8"

Not that I intend to check this, but UTF-8 appears to be the standard setting these days, and certain conditions demand that we know the character set.

debug = 1

I'm not sure what debug facilities I'll add to this software. But at this stage, whatever they are, it would be wise to turn them on. Later we can turn them off.

allow_anonymous = 1

Will we allow anonymous commenters? Sure, why not? (Remember 1 = true and 0 = false).

css_file = "style.css"

Here we allow the use to change the CSS on the fly. Handy if you want to experiment.

template_file = "templates/template.php"

I should explain the template file. This is the file which will contain the header, footer and all the main layout for at least the main page of the site. In the middle of this page will be an "include()" call to suck in the actual view for the data. But this will be the main template. So we'll allow the user to change this easily on the fly if they like. Again, this template may only be used for the main page. At this stage, I'm unsure.

That's about it for this. The page to edit this configuration will come later. But I wanted to know what values I'm going to have to check for as I go along writing the software.