Recent Topics

1 Apr 02, 2005 22:28    

One question:
I plan using a lot of categories, but - as far as I've seen - the menu ist rather static... Is there a way to generate a list like on the b2evolution main page, where the categories can get extended by clicking on the + ? (I also would need this fuctionality for the sub and maybe even sub-sub categories...

Thank You in advance...

2 Apr 09, 2005 06:02

Tiberius,

Kinda like [url=http://chunnering.net/]THIS?[/url] :D

I think the answer is yes, but I'm no pro. I just ran across the site when I was trying to help ShelaghG. Maybe you can figure out what he's done and or contact him for some help. Here's the [url=http://forums.b2evolution.net/viewtopic.php?t=3679&highlight=sunflower]POST[/url]

I do know that there are some list techniques that employ CSS ([url=http://css.maxdesign.com.au/listamatic2/]Listmatic[/url] is a good place to start) but I would think that javaScripting would be a more common approach.

This might get you in contact with someone that can help.

-Scott

3 Jul 12, 2005 09:29

It's pretty easy using just JavaScript. I ran across a pretty awesome tutorial for this while building another site of mine. Here's the important stuff.

This is the JavaScript that will expand and contract the list. If you don't like "javascript:switchit('linktitle')" showing up in your status bar, you can experiment with adding some code to change what the status bar says. Unfortunately, I don't have tips for that.

function switchit(list){
var listElementStyle=document.getElementById(list).style;
if (listElementStyle.display=="none"){
listElementStyle.display="block";
} else {
listElementStyle.display="none";
}
}

Since my list is generated dynamically, each list (which was in another list itself) looks like this.

<li><a href="javascript:switchit('[u]objectID[/u]')" title="any Title"><b>any Title</b></a>
<ul id="[u]objectID[/u]">
<li><a href="link1">like title1</a></li>
<li><a href="link2">linke title2</a></li>
<li><a href="link3">linke title3</a></li>
</ul></li>
<script type="text/javascript">
<!--
document.getElementById('[u]objectID[/u]').style.display="none";
-->
</script>

The last piece of JavaScript has to come AFTER the list has been created, so while the code for the switchit function goes in the header, the getElementsById function won't work unless the list it refers to has already been read. That piece of code sets the default display to "none" which means that it's invisible until you click on the link "any Title".

This will require you to hack the recursive categories function itself. If someone else hasn't filled in the blanks when I run by here tomorrow, I'll see if there's more I can do to help.

EDIT: removed unnecessary stylesheet/class coding from examples. Oops... forgot I found this thread through the search function. Just noticed it's been a few months since anyone posted to this. Let me know if I should continue.

4 Jul 12, 2005 21:34

Please do, as I'm no js guru and would like to try this at some point (I bet others would too).

Thanks in advance! ;)

5 Jul 13, 2005 00:52

stk wrote:

Please do, as I'm no js guru and would like to try this at some point (I bet others would too).

Thanks in advance! ;)

Yes! Please!! :)

6 Jul 13, 2005 03:12

Ok. I've got some work to take care of first, but I'll be back later tonight to fill in the blanks for you.

7 Jul 13, 2005 08:25

Sorry, can't do it tonight. Hope there's no rush.

8 Jul 14, 2005 03:00

I am at your mercy! ;)

No problem. I look forward to your educated reply when you have the time!

-stk :D

9 Jul 22, 2005 04:52

I've been busy with MBA classes, but I want you to know I haven't forgotten this. I should have an opportunity sometime Wednesday or Thursday of next week.

10 Jul 22, 2005 05:56

Thanks for the note.

We remain on summer holiday, so waiting isn't a problem. Will probably return the 1st of August.

Cheers,

-stk :D

11 Aug 05, 2005 15:17

anybody have a chance to make this work? i found a hack to make all categories try to expand but not one that makes only categories with subcategories expand.

Share the b2evo experience


Form is loading...