tigra
Administrator
Posts: 1916
Registered: 6/17/2002
Location: US, CO
Member Is Offline
|
| posted on 12/6/2004 at 04:48 PM |
|
|
ColdFusion server side for tigra menu scripts
Attached ColdFusion script will generate tigra menu hierarchy dynamically based on the data stored in database.
System requirements: script doesn't use any OS specific features so it will work fine on any server with CF server installed.
Script compatibility: All Tigra Menu scripts use very similar format of hierarchy structure. Attached script will work with:
- Tigra Menu v2.x
- Tigra Menu PRO (w/o item geometry support)
- Tigra Menu GOLD
- Tigra Tree Menu PRO.
With minor modifications script will work with:
- Tigra Menu v1.x
- Tigra Menu PRO (with item geometry support)
- Tigra Tree Menu
Script is distributed under Tigra Menu license (see product documentation)
Attachment: cf_tigra_menu_serverside.zip (12.09kb)
This file has been downloaded 1146 times
|
|
|
Russell411
Junior Member
Posts: 6
Registered: 4/3/2007
Location: California
Member Is Offline
|
| posted on 4/4/2007 at 05:35 PM |
|
|
For those trying to use this - there is no SQL file included - get that file (to create your database) from one of the other server side packages...
or use this code, from the Perl version (http://www.softcomplex.com/forum/viewthread_1958/).
-- --------------------------------------------------------------------------------
-- Description: Sample Database for Perl script for dynamic Tigra Menu generation
-- Version: 1.0
-- Coding: Softcomplex Inc <support[AT]softcomplex[DOT]com>
-- Date: 10/15/2004 (mm/dd/yyyy)
-- Tech. Support: http://www.softcomplex.com/support/
create database if not exists test_db;
use test_db;
drop table if exists menu_items;
create table menu_items (
id integer not null auto_increment,
parent_id integer,
pos integer,
caption varchar(50) not null,
link varchar(100),
target varchar(20),
statusbar varchar(100),
tooltip varchar(100),
primary key (id),
index idx_item_id (id),
unique (caption, parent_id),
foreign key (parent_id)
references menu_items (id)
on update cascade
on delete restrict
);
-- --------------------------------------------------------------------------------
insert into menu_items (id, parent_id, pos, caption, link, target, statusbar, tooltip)
values (1, null, 1, 'Home', '/', '_self', 'Home', 'Home');
insert into menu_items (id, parent_id, pos, caption, link, target, statusbar, tooltip)
values (2, 1, 1, 'Services', '/services.html', null, 'Services', 'Services');
insert into menu_items (id, parent_id, pos, caption, link, target, statusbar, tooltip)
values (3, 1, 2, 'Products', '/products.html', null, null, null);
insert into menu_items (id, parent_id, pos, caption, link, target, statusbar, tooltip)
values (4, 3, 1, 'Client Side Products', null, null, null, null);
insert into menu_items (id, parent_id, pos, caption, link, target, statusbar, tooltip)
values (5, 3, 2, 'Server Side Products', null, null, null, null);
insert into menu_items (id, parent_id, pos, caption, link, target, statusbar, tooltip)
values (6, 5, 1, 'PHP Image Gallery', '/products/php_image_gallery/', null, null, null);
insert into menu_items (id, parent_id, pos, caption, link, target, statusbar, tooltip)
values (7, 5, 2, 'PHP Event Calendar', null, null, null, null);
insert into menu_items (id, parent_id, pos, caption, link, target, statusbar, tooltip)
values (8, 5, 3, 'Apache Easy Debug', null, null, null, null);
insert into menu_items (id, parent_id, pos, caption, link, target, statusbar, tooltip)
values (9, 3, 3, 'Online Services', null, null, null, null);
insert into menu_items (id, parent_id, pos, caption, link, target, statusbar, tooltip)
values (10, 3, 4, 'Win32 Applications', null, null, null, null);
insert into menu_items (id, parent_id, pos, caption, link, target, statusbar, tooltip)
values (11, 3, 5, 'ActiveX Components', null, null, null, null);
-- --------------------------------------------------------------------------------
Also, this script does NOT seem to work with Tigra Menu 2.x - as it creates a set of data called "TREE_ITEMS" with different parameters than the
data set "MENU_ITEMS" which Tigra Menu is looking for.
Anyone have a solution for this already built?
Thanks,
Russell Schutte
|
|
|
tigra
Administrator
Posts: 1916
Registered: 6/17/2002
Location: US, CO
Member Is Offline
|
| posted on 4/4/2007 at 08:27 PM |
|
|
TREE_ITEMS and MENU_ITEMS have similar format. Try just renaming the variable where it's defined in server side script or renaming it where you
supply it to the object's initialization (in either case two should match)
|
|
|
Russell411
Junior Member
Posts: 6
Registered: 4/3/2007
Location: California
Member Is Offline
|
| posted on 4/4/2007 at 09:34 PM |
|
|
They're not in the same format, as far as I can tell.
From the ColdFusion Download, the format is:
var TREE_ITEMS =
[
['Services', '/services.html, {'id':2, 'fn':1}, ],
['Products', '/products.html', {'id':3, 'fn':1},
[
'Client Side Products', '', {'id':4, 'fn':1}, ],
['
Server Side Products', '', {'id':5, 'fn':1},
['PHP Image Gallery', '/products/php_image_gallery/', {'id':6, 'fn':1}, ],
['PHP Event Calendar', '', {'id':7, 'fn':1}, ],
['Apache Easy Debug', '', {'id':8, 'fn':1}, ]
],
['Online Services', '', {'id':9, 'fn':1}, ],
['Win32 Applications', '', {'id':10, 'fn':1}, ],
['ActiveX Components', '', {'id':11, 'fn':1}, ]
]
];
My existing MENU_ITEMS (version 2.0) looks like this:
/* Tigra Menu items structure */
var MENU_ITEMS = [
['Elementary', 'index.cfm?PageID=32', null,
['Applications of Science', 'index.cfm?PageID=2']
],
['Middle School', 'index.cfm?PageID=36', null,
['Business', 'index.cfm?PageID=7'],
['Career Explorations', 'index.cfm?PageID=6'],
['Computer Aided Design', 'index.cfm?PageID=12'],
['Computer Applications', 'index.cfm?PageID=8'],
['Construction', 'index.cfm?PageID=18'],
['Family & Consumer Science', 'index.cfm?PageID=4'],
['Health', 'index.cfm?PageID=5'],
['Health Careers', 'index.cfm?PageID=19'],
['Technology Explorations', 'index.cfm?PageID=1'],
['Virtual Engineering', 'index.cfm?PageID=20']
],
['High School', 'index.cfm?PageID=33', null,
['Automotive Technology', 'index.cfm?PageID=17'],
['Business', 'index.cfm?PageID=37'],
['Computer Aided Design', 'index.cfm?PageID=38'],
['Computer Repair & Networking', 'index.cfm?PageID=10'],
['CIM Systems & Flexible Manufacturing', 'index.cfm?PageID=21'],
['CNC Machining', 'index.cfm?PageID=22'],
['Construction', 'index.cfm?PageID=39'],
['Electronics', 'index.cfm?PageID=11'],
['Health', 'index.cfm?PageID=40'],
['Health Careers', 'index.cfm?PageID=41'],
['Industrial Maintenance', 'index.cfm?PageID=16'],
['Information Technology Certification', 'index.cfm?PageID=9'],
['Laser Engraving', 'index.cfm?PageID=23'],
['Manufacturing & Robotics', 'index.cfm?PageID=14'],
['Microsoft Office Training & Certification', 'index.cfm?PageID=24'],
['Office Software', 'index.cfm?PageID=24'],
['Pre-Engineering', 'index.cfm?PageID=15'],
['Rapid 3D Prototyping', 'index.cfm?PageID=13'],
['Technology Foundations', 'index.cfm?PageID=3']
],
['College', 'index.cfm?PageID=34', null,
['Automotive Technology', 'index.cfm?PageID=69'],
['Computer Aided Design', 'index.cfm?PageID=42'],
['CIM Systems & Flexible Manufacturing', 'index.cfm?PageID=43'],
['CNC Machining', 'index.cfm?PageID=44'],
['Construction', 'index.cfm?PageID=45'],
['Electronics', 'index.cfm?PageID=46'],
['Engineering', 'index.cfm?PageID=25'],
['Information Technology Certification', 'index.cfm?PageID=47'],
['Manufacturing & Robotics', 'index.cfm?PageID=48'],
['Mechatronics', 'index.cfm?PageID=26'],
['Microsoft Office Training & Certification', 'index.cfm?PageID=49'],
['Rapid 3D Prototyping', 'index.cfm?PageID=50'],
],
['Industry', 'index.cfm?PageID=35', null,
['Automotive Technology', 'index.cfm?PageID=51'],
['Computer Aided Design', 'index.cfm?PageID=52'],
['CIM Systems & Flexible Manufacturing', 'index.cfm?PageID=53'],
['CNC Machining', 'index.cfm?PageID=54'],
['Construction', 'index.cfm?PageID=55'],
['Electronics', 'index.cfm?PageID=56'],
['Industrial Maintenance', 'index.cfm?PageID=57'],
['Information Technology Certification', 'index.cfm?PageID=58'],
['Manufacturing & Robotics', 'index.cfm?PageID=59'],
['Mechatronics', 'index.cfm?PageID=60'],
['Microsoft Office Training & Certification', 'index.cfm?PageID=61'],
['Rapid 3D Prototyping', 'index.cfm?PageID=62'],
['Specialized Training', 'index.cfm?PageID=63']
],
['Support', null, null,
['Phone Numbers', null],
['Tutorials', null]
],
['Company', 'index.cfm?PageID=31', null,
['History', 'index.cfm?PageID=31'],
['Customers', null],
['Contact Us', null]
]
];
These aren't the same format... What have I got wrong? I don't have id & fn fields. Simply renaming MENU_ITEMS to TREE_ITEMS doesn't solve
it. :-)
Thanks for taking a look Tigra,
Russell Schutte
|
|
|
tigra
Administrator
Posts: 1916
Registered: 6/17/2002
Location: US, CO
Member Is Offline
|
| posted on 4/4/2007 at 10:26 PM |
|
|
the format is actually the same, but one of the variables in your sample doesn't use all its features, and there are some errors in one of them.
['Services', '/services.html, {'id':2, 'fn':1},
['Elementary', 'index.cfm?PageID=32', null,
1. caption: ('Services' and 'Elementary')
2. link: ('/services.html - syntax error, no closing apostrophe and 'index.cfm?PageID=32'
3. item scope settings ({'id':2, 'fn':1} and null)
4. subitems, if any (syntax error - comma before closing bracket)
ColdFusion download is the user's submission, we didn't have a chance to test it because we don't use ColdFusion server. We'll greatly appreciate
if you can fix the problems in the code.
|
|
|
|