Internet : HOWTO - Blogger Categories

This small HOWTO try to explain a easy way to put categories on “Blogger’s Blog” published on PRIVATE FTP, it will NOT WORK with .blogspot blog.

NOTE : the way i implemented for the menu may not work in IE, don’t know why..!

You can see a preview here : Categories in Blogger

The idea is pretty simple.

If you place a Unique name before the post every post-file will begin exactly in that way.
Example :

title : Mac’s Stuff : New MacBook Pro
filename: macs-stuff-new-macbook-pro.html
title : Mac’s Stuff : New iMac CoreDuo
filename : macs-stuff-new-imac-coreduo.html

i’ve done a very small PHP script that browse all the FileSystem looking for file that include a certain word (it work with regular expression so is pretty simple customize-it and do everything you need…)

This is the script, you need to place it exactly before the </head> tag on the model code.

This script take 3 input :
$dir (the starting dir, you should want just the 2006 post or 2006/01/ it’s easy to customize, ex. a little script that show only the current month post of that cat etc…)
$match (the text identify your category)
$n (the length of the category name+1 (example “macs-stuff” is 10+1=11)

Perfect you’ve almost done :)

Just place before the PHP code this script for the tree menu :

<script language="javascript">function showboxmenu(nomebox, flag) { (flag==0) ? flag = 'none' : flag = ''; document.getElementById(nomebox).style.display = flag; }</script>

And in the sidebar after the profile stuff this code :

<h2 class="sidebar-title">Categories</h2> <ul>  <div onMouseOver="showboxmenu('cat1', 1)" onMouseOut="showboxmenu('cat1', 0)">      <li><a  href="">Mac's Stuff</a></li>    <div id="cat1" style="display: none">    <?php    recursive_find("./","macs",10);            // start from ./ look for "macs" and cut 11 char ("macs-stuff-")    ?>  </div></div> </ul>

if you need another category just place this before the </ul>

  <div onMouseOver="showboxmenu('cat2', 1)" onMouseOut="showboxmenu('cat2', 0)">   <li><a  href="">newcategory</a></li>  <div id="cat2" style="display: none">  <?php  recursive_find("./","newcategory",12);          // start from ./ look for "newcategory" and cut 12 char ("newcategory-")    ?>  </div></div>

I’m pretty sure my scritp will be very buggy, i’v just write down yesterday night, but i hope will be usefull for someone, for start something better,in the meanwhile i hope will find the time to update my script to JS to let it work with .blogspot blog.

Any usefull help will be very appreciate :)

If i have miss something or mispelled some code transcribing here let me know, i’m a “very disordered boy” :D

For any info or bug post a comment here.

ps: Sorry Sorry Sorry for my very bad english ! :D


8 Comments

  1. Gaby de Wilde, January 23, 2006:

    yes, making stuff like this is great to get to know people. :)

  2. DSoM, January 23, 2006:

    :D

  3. Marco C., January 24, 2006:

    From what i can understand you rely on a server side hack to make categories (it look on fs to get the name and the url of posts). It’s impossible to make this in javascript ‘couse this act on client side. Sorry mate ;)

  4. DSoM, January 24, 2006:

    it’s what i suppose, but i’m working on a funny workaround… ;) stay tuned!

  5. Amit, February 2, 2006:

    Check out something I have worked up on http://nerdierthanthou.nfshost.com/ related to categories.

  6. Paolo Alberto Caneva, February 26, 2006:

    Ciao dsom, sarei molto interessato al tuo progetto sulle categorie ma non sono affatto pratico con l’inglese e tanto meno con la compilazione di codici. Potresti creare un HOWTO in italiano? :-)
    Nel mio blog ho già inserito una possibilità per le categorie ma non mi soddisfa molto.
    Ho visto poi il progetto di AMIT e mi sembra ancora più perfezionato ma non sono in grado di valutarlo…
    mi dai una mano
    grazie
    paolo
    ps. se vuoi contattarmi via mail cnvpaolo@@@tin.it

  7. DSoM, April 12, 2006:

    purtroppo per adesso ho sviluppato solo quello in inglese.
    Visto che ho anche aggiornato lo script potrei infatti pensare di scriverne uno in italiano.. ma la voglia è quella che è :)

    a presto :)

  8. chinching, July 2, 2006:

    I’m not sure whether this will work, but I’ll give it a try! If it does work, then I’ll tell my other friends.

    I almost know nothing else at all about HTML and I’m sick of those Blogger Help articles which always assume you to be an expert in computer language.

    However, this one looks very simple to do… HOPE IT WORKS!!! ;-)

Leave a comment