[Catonano]
We have a folder with a bunch of html files in it.
What I want to do is to make a drop down menu filled with some values.
Each one of these values individuates one of the files in the folder.
If I, as user, choose a code from the drop down menu, it should take me to the associated file (web page, that is).
The files are not dinamically produced by Zope, they are simple statical html files made by some collagues of mine with DreamWeaver and uploaded via ftp into my folder.
So the files are located in the file system and not in the Zope database. I would search the archives for the "localFS" product, and see how to get it to give you a list of the file names it controls. Then you can refer to them by title.
I could ask my collagues to include the code in every page (file) in a html-compliant shape, so Zope could acces that code and CATALOGUE those pages indexing that code, so I could try with a multiple choiche menu.
Is it clearer?
Do you mean that each file is supposed to be tagged with some code, and that the file name is not adequate for listing in a menu? Seems like you have three types of things you can do to discover the code value: 1) Put the code into the filename and use string processing to extract it. This requires the the people producing the file name the file correctly. 2) Put the code into the html file itself. The best place for this would be a <meta> element. This requires you to extract the code value from the HTML file as you started out asking about. It also requires the people generating the file to insert the code value correctly. This approach is the most markup-language like approach. If you put it into a META element, you ought to be able to retrieve it using a regular expression. That would probably be the simplest thing to do. You would probably do that using a python external method. 3) Compute the right code value usng some algorithm. I have no idea if that would be possible for your files or not. If it is possible, you would not depend on the file creator to handle the code properly. Once you know what the code value is, you want to use it somehow. That is the subject of your next questions, I take it -
My idea is that I have 2 alternative ways:
1) add a field property to each file and fill it with the code, then adding an index to my ZCatalog. Boring, error prone and time consuming.
2) ask my collagues to inclue the codes in the html files and get Zope access and index that values.
Another approach would be to create a DTML method that returns a dictionary of code file identifiers keyed by the codes. You would use that dictionary when you build the menu. I have never done this programatically but it ought to be possible. Otherwise, you could write an external method to do the same thing by reading a file that contains the dictionary in text form (you create the dictionary by using eval()). When you receive a new file (or periodically using a scheduled task) you would look through the directory and build a new version of the dictionary. It ought to be easy. Cheers, Tom P