Support Forum Softcomplex logo
About Us  | Services  | Download  | Order  | Support  | |
| Search | Today's Posts | Stats | Board Rules | Not logged in [ Login | Register ]
go to bottom
Last active: Never

Printable Version | Subscribe | Add to Favourites   Post new thread
Author: Subject: Force folder icon for "empty" folders?
Junior Member

Posts: 3
Registered: 8/16/2004
Member Is Offline
posted on 8/23/2004 at 03:28 PM Reply With Quote
Force folder icon for "empty" folders?

I am generating the Tree Menu from hierarchical records in a database. Each record has both a unique ID and a "parent" field that refers to the ID of its parent. I have also created a third field called "is_folder" that can have one of three values: 2=tree root, 1=folder, 0=document/page. I created this field because I am using it with a three option IF,THEN,ELSE statement in the tree/items.asp file to control the HREF action when a user clicks on a branch or leaf from the menu. (When user clicks on a page, I want to display the page. When user clicks on a folder, I want it to list the folder contents. When user clicks on the root, I want it to display the home page.)

Anyway, here's my dilemma... If I create a new "folder" that is either under the root, or under another folder, it gets a "page" icon until I create some documents under it. I assume this is because the applet sees this as a child until another record lists it as a parent, correct?

How can I get the applet to assign icons based upon my "is_folder" field value, rather than automatically by whether or not there are any child records below it?

If seeing my modified code will help, let me know and I'll post it.

View User's Profile View All Posts By User U2U Member

Posts: 2049
Registered: 6/17/2002
Location: US, CO
Member Is Offline
posted on 8/23/2004 at 06:49 PM Reply With Quote

in Tigra Tree Menu PRO with item scope settings you can assign icons per item (see tigra tree menu pro documentation). With this feature you can assign node icons to the item tree considers leaf.

To optimize the size of the structure you may want to create item scope templates for different types of items and reference them in hierarchy:

var folder_settings = { ... params here ..};
var document_settings = { ... params here ..};

then in hierarchy:

['my folder 1', 'some_url.html', folder_settings],
['my folder 2', 'some_url2.html', folder_settings],
['my document 1', 'some_url2.html', document_settings]

View User's Profile View All Posts By User U2U Member
Junior Member

Posts: 3
Registered: 8/16/2004
Member Is Offline
posted on 9/9/2004 at 12:31 AM Reply With Quote

I've been trying this for several days now, but just can't figure it out.

Where would I define these custom parameters? In the items.asp file? Or in the tree_tpl.js file?

My tree is being dynamically generated from a database, and I'd like the value of my "is_folder" field to dictate the icon that appears on the tree.

If "is_folder" = 2, then this is the tree root
If "is_folder" = 1, then this is a folder
If "is_folder" = 0, then this is a page

Does that make sense?

Any help would be GREATLY appreciated!
View User's Profile View All Posts By User U2U Member
Junior Member

Posts: 2
Registered: 9/29/2005
Member Is Offline
posted on 9/30/2005 at 12:48 PM Reply With Quote

I had the same need (to switch icons based on what was in the database) and this worked for me:

Define the icon definitions as Javascript variables in the tree_tpl.js file. In my case, I only wanted to switch between using the folder icons and page icons (for each additional set of icons, define another variable):

var FOLDER_SETTINGS = {'i0':'icons/folder.gif',...'i76':'icons/folder.gif'};
var DOCUMENT_SETTINGS = {'i0':'icons/page.gif',...'i76':'icons/page.gif'};

When you generate your TREE_ITMS file, have it put the variable names FOLDER_SETTINGS and DOCUMENT_SETTINGS where you'd normally put the {'i0':'icons/folder.gif',...'i76':'icons/folder.gif'} strings:

['my folder 1', 'some_url.html', FOLDER_SETTINGS],
['my folder 2', 'some_url2.html', FOLDER_SETTINGS],
['my document 1', 'some_url2.html', DOCUMENT_SETTINGS]

Then, to make the new variables available to the tree, pass them as parameters when you instantiate the tree:


View User's Profile View All Posts By User U2U Member
Post new thread

Related Links:
Product Page
Product Demonstrations Live Demos
Multiple Trees
Frames Targeting
Icons and Styles Overloading
Event Handling
Performance Test
Version 1.2 features
Product Documentation Documentation
Documenation Page
Change Log
Support Forum Technical Support
Support Forum
Customer Care System
Order Now ORDER NOW!
Add to Cart
View Cart

Go To Top

Powered by XMB 1.9.1 Nexus
Developed By Aventure Media & The XMB Group © 2002-2004