Moshare - Blogger Categories

Monday, March 06, 2006

Release Notes: 2005-0306 Blogger Categories Script Setup Instructions

How-To Instructions: Set Up Steps for Blogger Categories Publisher

Version: 1.0
Release date: 2006-0305

Note: This script is written in PHP and requires you to have your own hosting account outside of blogspot.com. The sample code snipets in the steps below were taken from an actual sample site using one of Blogger's blog templates. If you don't have your own hosting account with PHP, just search Google for "cheap php hosting" or "free php hosting"...


Step 1: Edit your Blog's template and insert content markers

Login to your Blogger account and go to the Template setting page. Insert the opening and closing markers for the page heading text <!-- <[MainHeading]> --> <!-- </[MainHeading]> -->. See the following example:

<h1><!-- <[MainHeading]> -->
<ArchivePage><a href="<$BlogURL$>"></ArchivePage>
<ItemPage><a href="<$BlogURL$>"></ItemPage>
<$BlogTitle$>
<ArchivePage></a></ArchivePage>
<ItemPage></a></ItemPage><!-- </[MainHeading]> --></h1>


Step 2: Insert the opening and closing markers for the main content

This is where the body of your page is. It will contain the links to your blog pages for each category. <!-- <[MainContent]> --> <!-- </[MainContent]> --> See the following example:


<MainPage>
<!-- <[MainContent]> -->
...
<!-- </[MainContent]> -->
</MainPage>


Step 3: Insert the PHP includes in your template

Insert the PHP file include code to add the categories to your main blog (home) page.
This should be somewhere between the <!-- <[MainContent]> --> and <!-- </[MainContent]> -->.
See example below:


<h2>Hot Tips</h2>
[open php block]
$incFileName = "./html/toc/tips-all.html";
if (file_exists($incFileName)) include_once($incFileName);
[close php block]


Step 4: Publish your changes in your Blogger account


Step 5: Edit the file blogger-categories.txt

Open the file blogger-categories.txt with a text editor (like Notepad) and enter your category values. Sample values are in the file for illustration. Please replace the values with your own category names. Be sure to follow the following format:


label name,category name,links list filename,category filename,category header text


Keep the label name and category name in the .txt file in all caps.
Here's an example:


TIP,TIPS,tips-all.html,index_tips.php,Cool Tips
TIPS,TIPS,tips-all.html,index_tips.php,Cool Tips


The label name (first element) is what you use to tag a blog post to make it belong to a category.
The category name (second element) is self explanatory.
The links list filename (third element) is a file that contains a list of links for that category, unordered list <ul></ul>
The category filename (fourth element) is a file that inherits your blog template HTML. You use this filename in step 6. This is the page you link to for a category.


This script only allows you to assign one category to a post. You can however have several labels that belong to a single category.
For example, TIP and TIPS both belong to the TIPS category.
To tag a post, use the label followed by a colon: in the title of the post.
Here's a sample labeled post's title for the TIPS category:


Hot Money Saving Tip: Review Your Bank Statement Regularly


Notice how the word Tip: is followed by a colon. The label name can be lowercase when you tag your post's title.



Step 6: Edit the values in the main publisher script below

The two following variables must have correct values in order to work properly.
$tocOutputDir is the output directory for your category files
$blogIndexFile is the name of your main blog's file (index file, usually index.php)


Step 7: Upload your files to your web hosting account

FTP the files blogger-categories.txt and blogger-categories-publisher.php to your web hosting account. Again, this is not for blogs hosted with blogspot.com...
It is recommended you rename this file to something else to prevent someone from just hitting it by accident.
Do not link to the blog publishing script from your website unless it's on a protected page. Just type in the URL to this script once it's ready and bookmark it so you can republish as needed.
http:// your-blog-domain.com /rename-the-file-blogger-categories-publisher.php


Step 8: CHMOD write permissions for the publisher script

Change permissions on your output directory so your web server has write permissions. This allows the script to write the category files in the target directory. Don't worry, it's perfectly safe!


Step 9: Load the URL for the blog publishing script

Open your browser and load the URL for the script. You should see status messages telling you which category files are generated and how many links each one contains. A category page is created only if there is at least one link to display.


// End How-To Instructions

0 Comments:

Post a Comment

Link to this post:

Create a Link

<< MoShare.com Home


Google
 
Web www.moshare.com

 
 

Powered by Blogger

 
Moshare Google group | Yahoo! Group | MSN Group
 
moshare.com - blogging tools & resources ©2006