Friday, July 13, 2007

Creating DropDown Menubar

I have been wanting to post this cool blogger hacks for a while, but due to my busy daily routines I haven't found time to really post it. But now because there are two people who ask about it, I decide it to give it a try. This hack was originally created by Alastor in his blog, you can read his full guide to make this hack works here. All credits must go to him, as I was just using it in my blog. There is also another hack to show recent post in the dropdown menu, which was made by Vivek Singh. You can find all the details here. Now, I didn't just use it as it is, because I was not satisfied by listing all my categories in the dropdown menu (which can be many categories). So I did a little hacking by myself to limit the number of categories you want in your drop down menu. I have tested here in my blog and it worked. If you want to try, feel free to give it a try but don't forget to back up your template first. If something goes wrong, you can always revert to your old template.
I based my hack on Alastor's. All the steps required are the same as his. But I replace the code in his post in the "a) Categories in the Menubar:", with this code here.
This code is used to limit the number of categories to 10, if you want to have more just replace the number 10 in "if (labelnum++ < 10)" to whatever number you want. Remember there are two lines which are using the number "10", be sure to replace both of them. Ok, there you go your dropdown menu is ready to be tested. If you have any questions feel free to leave it at the comment section of this post or just shout in the shout box. Cheers!

6 comments:

  1. thank's yach but sy dah coba nih tapi masih pusing khususnya pada langkah keempat bagian a (Categories in the Menubar) kepunyaan http://non-alastor.blogspot.com/2006/11/dropdown-menubar.html sy masih kurang mengerti....

    bisa di jelaskan nda friend

    terima kasih yach sebelumnya

    ReplyDelete
  2. Gus, bagusan mana 'drop down menu' ato 'tree menu' ya?

    ReplyDelete
  3. terus terang saya lom pernah pake tree. tapi kalo tree lebih banyak item yang bisa dimasukkan. misal kalo kita punya kategori yang banyak, kalo pakai dropdown menu jadinya gak bagus juga. tapi untuk itulah scriptnya saya edit jadi cuma ditampilkan 10 kategori yang postingnya paling banyak. jadi balik lagi ke keperluan, misal untuk home kan emang lebih bagus kalo kita taruh di atas, lebih praktis aja sih menurut saya. he3x, kembali ke.... yang punya blog. :D

    ReplyDelete
  4. hello- i am a true amateur to this and can't seem to get place the code properly. can you tell me where each string goes exactly? i'm using the classic template, white.

    thank you very much in advance,
    -kevin

    ReplyDelete
  5. Halo Agus, salam kenal. Saya baru saja di direct dari blognya Alastor. Thanks atas work aroundnya. Karena sebelumnya, label saya banyak, dropdownnya mulai dari top of page. Sekarang sudah tidak tapi label saya jadi terbatas. Maximum cuma 15. Well at least it drops correctly.

    Thanks yah... :))

    ReplyDelete