We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Locked Topic
[ C ] Category Description
Topic Started: Aug 3 2010, 02:59 PM (307 Views)
AimeeTheGreat
Member
[ * ]
Board Address: Private
Board Software: Zetaboards
Description: I would like just a simple code to have a "category description" in slightly smaller text below the category name, somewhat like a board description. Also, it needs to be the same font color as the category name (#FFFFFF).

thank you. :)
Offline Profile Goto Top
 
ElementalAlchemist-ZNR
Member Avatar
Member
[ *  *  *  *  * ]
If you know how to get category numbers, this code is definitely better than the one after it (more efficient, immune to category name changes). For this one, you'll want to add rows following the example one already there with the following format for each category to add a description to:
Code:
 
[ "category ID number", "Category description" ]
Code: HTML
 
<script type="text/javascript">
$(function () {
var catdesc = [
[ "319228", "A place for news and discussion." ]
];
for (var i = 0; i < catdesc.length; i++) {
var cattitle = $("#cat-" + catdesc[i][0] + " .cat_head a");
cattitle.html(cattitle.html() + "<br /><span style=\"font-size:80%\">" + catdesc[i][1] + "</span>");
}
});
</script>
However, if you don't know how to get category ID numbers, here's a version with the category name. You'll want to configure the same as above, except in this format:
Code:
 
[ "category name", "category description" ]
Code: HTML
 
<script type="text/javascript">
$(function () {
var catdesc = [
[ "News & Discussion", "A place for news and discussion." ]
];
$("table.cat_head a").each(function () {
var desc = -1;
for (var i = 0; i < catdesc.length; i++) {
if (catdesc[i][0] == $.trim($(this).text())) {
desc = i;
break;
}
}
if (desc != -1)
$(this).html($(this).html() + '<br /><div style="font-size:80%">The place to get news and feedback.</div>');
});
});
</script>
Offline Profile Goto Top
 
AimeeTheGreat
Member
[ * ]
Ok, I think to get the category number, is this it?
/Board_Name/forum/3065431/

Also, I'm not quite sure which part to put the code in. I was fairly sure it was Javascript/start of board but it didn't seem to work so I tried the other ones.

Thanks :)
Offline Profile Goto Top
 
ElementalAlchemist-ZNR
Member Avatar
Member
[ *  *  *  *  * ]
AimeeTheGreat
Aug 3 2010, 10:50 PM
Ok, I think to get the category number, is this it?
/Board_Name/forum/3065431/

Also, I'm not quite sure which part to put the code in. I was fairly sure it was Javascript/start of board but it didn't seem to work so I tried the other ones.

Thanks :)
Just the number in there, yes. If you click on the category name and take that number, it'll work that way, too. :)
AimeeTheGreat
Aug 3 2010, 10:50 PM
Also, I'm not quite sure which part to put the code in.
Sorry, I forgot to say. :P Below the board should work. :)
Edited by ElementalAlchemist-ZNR, Aug 3 2010, 11:12 PM.
Offline Profile Goto Top
 
AimeeTheGreat
Member
[ * ]
I can't seem to get it to work. Here's what it looks like:

Code:
 
$(function () {
var catdesc = [
[ "3065431", "yada yada" ]
[ "3065905", "blah blah blah" ]
[ "3065463", "placeholder" ]

];


I don't have any other scripts except for this in the javascript:
Code:
 
<meta name="robots" content="noindex" />


I can provide access to the board via a test account, however Id like to keep it private by not posting the link anywhere public (its a long story).

thanks again.
Offline Profile Goto Top
 
Roby-ZNR
Member Avatar
Efficacy
[ *  *  *  *  *  * ]
It just needs commas. :) The last set of square brackets you include should not have a comma after it, but the rest should.
Code:
 
$(function () {
var catdesc = [
[ "3065431", "yada yada" ],
[ "3065905", "blah blah blah" ],
[ "3065463", "placeholder" ]
];
Offline Profile Goto Top
 
AimeeTheGreat
Member
[ * ]
Figured it was something simple. The code works now. Thanks :D
Offline Profile Goto Top
 
ElementalAlchemist-ZNR
Member Avatar
Member
[ *  *  *  *  * ]
Glad we could help. ^_^

Completed!

Your request has been completed. If you have any questions or concerns regarding the state of your request, please feel free to contact me via PM.
Offline Profile Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Closed Requests · Next Topic »
Locked Topic