PDA

View Full Version : Description Under Sub-Category Thumb?


crockett
Mar-20-2007, 06:14 PM
Example:

If I have a couple category thumbs on my homepage, you click and it takes you to a bunch of sub-category thums on another page. These sub-category thumbs have the sub-category "title" listed under each thumb.

Is there a way to put a brief description of the sub-category under that title?

ivar
May-18-2007, 06:02 AM
Hi :wave

I can't think of anything right of the top of my head. Maybe someone else has an idea? :ear

docphoto
May-28-2007, 07:23 PM
I was looking for something different, a paragraph above the categories and found it in this thread:
http://www.dgrin.com/showthread.php?p=241923#post241923

I am sure that isn't what you wanted, but some simple modifications should work, allowing you to add a description directly under the sub-Category title. I haven't tested this extensively (I'm a raw noob at this -- I don't even know how to make it recognize spaces in the subcategory name), so hopefully more experienced hands can take over.

/*==============================*/
/* the subCategory descriptions */
/*==============================*/
function addSubCatDescription() {
var SubCatDescription = {
"subcategory1" : "This is a test.",
"subcategory2" : "This is a test."
};

if ((YD.hasClass(document.body, "category")) && (!YD.hasClass(document.body, "subcategory"))) {

re = /category_(\S+)/i;
re.exec(document.body.className);

albumtitle = YD.get("albumTitle");
if (albumtitle && SubCatDescription[RegExp.$1]) {
divTag = document.createElement("div");
divTag.className = "SubCatDescription";
divTag.appendChild(document.createTextNode(SubCatD escription[RegExp.$1]));
albumtitle.parentNode.insertBefore(divTag, albumtitle.nextSibling);
}
}
if (YD.hasClass(document.body, "homepage")) {
re = /\>([\w\-]+)<\/a>/i;

divTag = YD.get("categoriesBox");
if (divTag) {
divTags = YD.getElementsByClassName("albumTitle", "p", divTag);

for (i=0; i<divTags.length; i++) {
re.exec(divTags[i].innerHTML);
if (SubCatDescription[RegExp.$1] != undefined) {
pTag = document.createElement("p");
pTag.className = "SubCatDescription";
pTag.appendChild(document.createTextNode(SubCatDes cription[RegExp.$1]));
divTags[i].parentNode.insertBefore(pTag, divTags[i].nextSibling);
}
}
}
}
}
YE.addListener(window, "load", addSubCatDescription);
Replace the "subcategory1" with the name of your subcategory, and replace "This is a test." with your description.

Good luck with the modifications.