PDA

View Full Version : Perl + JavaScript = Hierarchical List


pendulum
01-30-2005, 03:53 AM
The problem is that I need to read the list items from a simple text file and
build a hierarchical list using these items.

How simple is it to use Perl-variables and their values in a JavaScript script? :confused:

I was thinking that I would use Perl to read the file contents and then use JavaScript to sort them into hierarchical order

The list is written as followed:

#Main Title 01
##Sub Title 01
##Sub Title 02
###Sub Title 01 of Sub Title 02
#Main Title 02

etc....... you get the idea (the amount of #'s signify the list level)

So, can I use a direct reference in my JavaScript code to a variable name in Perl? Any suggestions?

mlseim
01-30-2005, 04:35 AM
Do you already have the Javascript portion that does the menu?

If so, post the Javascript part and a small sample of what the
text datafile would look like.

Perl can then create the dynamic HTML webpage.

pendulum
01-30-2005, 11:32 AM
I don't have the JavaScript part yet, because I've just started with the
problem. I'll get back to you when I have some sort of skeleton of the
JavaScript part. The textfile is in the form i wrote earlier.

#MainTitle 01
##SubTitle 01
##SubTitle 02
###Susbtitle 01 of SubTitle 02
#MainTitle 03

etc...

These strings could be read character by character to get the level info from
the amount of #'s

Thanks a bunch for any kind of help!! It is needed by this newbie :)