Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

HTML Forum


You are currently viewing our HTML Forum as a guest. Please register to participate.
Login



Post a Project »

Find a Professional HTML Freelancer!

Find a Freelancer to help you with your HTML projects

FREE Outsourcing eBook!

Reply
How to make an A-Z index of site?
Old 01-04-2009, 02:22 PM How to make an A-Z index of site?
Junior Talker

Posts: 2
Name: Marshall Abrams
Location: Silver Spring, MD
Trades: 0
I'm developing a set of related web pages for which I wish to make a common index (not an web page index.html, but a conventional index such as you see at the end of a book). I'll be including important terms that will be linked to the individual web page.

I would like the entries in the index to an an alphabetically sorted list where all the items on the list are links. I can try to sort it manually as I build it (and manually correct errors that will occur) but I'd much rather have a tool for making the index.

I figured how to make a single-level index using Excel, but I can't think of how to get a two-level index of the form
topic
sub-topic entry 1
sub-topic entry 2
Suggestions very much appreciated.
MarshallAbrams is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-04-2009, 09:14 PM Re: How to make an A-Z index of site?
Extreme Talker

Latest Blog Post:
Chocolate Dessert With Diamond
Posts: 247
Trades: 0
I think you need to create a database for all your pages to make it dynamic.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

ajcones is offline
Reply With Quote
View Public Profile Visit ajcones's homepage!
 
Old 01-04-2009, 09:56 PM Re: How to make an A-Z index of site?
Decaf's Avatar
Ultra Talker

Posts: 489
Name: Adam
Trades: 0
or search for every file and print them in a list.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Decaf is offline
Reply With Quote
View Public Profile Visit Decaf's homepage!
 
Old 01-05-2009, 06:59 AM Re: How to make an A-Z index of site?
Junior Talker

Posts: 2
Name: Marshall Abrams
Location: Silver Spring, MD
Trades: 0
Yes, Ajcones, I do need to create a database. That's what I'm doing in Excel. I've figured out how to get that databse to sort alphabetically to produce first-level index terms, but can't figure how to get second-level. Do you have a specific technique or a different database in mind?

If all I wanted was a list of files, Decaf, I could do that lots of ways. As I said, I'm trying to use meaningful index terms.
MarshallAbrams is offline
Reply With Quote
View Public Profile
 
Old 01-05-2009, 07:54 AM Re: How to make an A-Z index of site?
Banned

Posts: 923
Name: Geoff Vader
Location: In my dreams
Trades: 0
As a perl programmer it's really hard for me to say this, but I've realised no one really listens to good advice, so here's some slightly worse advice than "use perl".

USE PHP.

You need:

a table of the information (maybe you can keep it in an sql database, that tends to be the normal mainstream choice, but if you only have a few dozen or few 100 items, there's nothing really wrong with just storing it in a tab-delimited text file)

a script (in php, for example, or perl!) which can "sort" the list (sort commands are pretty common in scripting languages)

and that's it. No more copying pasting from excel, saving the document, having to update it by hand every time - just have a php script which dynamically puts the list into alphabetical order and presents it as your AtoZ index... then you just have to add new data to the end of the list and it will automatically be put in the right order.

On my site I have an atoz index, but it is not produced the way I have shown - it is produced manually whenever I update the database, which I rarely do - it's still script driven - I run a special script just for creating the updated alphabetical list.

This is the perl code involved

Code:
#!/usr/bin/perl

  print "Content-Type: text/html\n\n";
 open (file, "<raw_list.txt");
 @array=<file>;
 close (file);

 print "opened illin<br>";

 use locale; # Use POSIX locales to define sort order

 @sorted = sort { ($da = lc $a) =~ s/[\W_]+//g;
                  ($db = lc $b) =~ s/[\W_]+//g;
                  $da cmp $db;
                  } @array;

 print "did funky ****<br>";

 open (file,">alphabetical_list.txt");
 foreach $sorted(@sorted){
 $sorted=~s(\A\W)()g;
 @parts=split(/\t/,$sorted);          
 print file "$parts[0]\n";         
 }             
 close (file);
 print "did lastbit<br>";
  print "alpha-list compiled";
wow! even my code has swear words that get censored. what a foul mouthed lad I am.

Of course if you want to just use shell script or do it from the commandline (if you happen to have your stuff running on a linux server and happen to have ssh access) then this is all you need to know...

Code:
cat woojoo | sort
woojoo happens to be a file with lots of data,
cat is the command to list its contents
the | is a "pipe" which channels the output to the next command
sort - is the command which sorts it in alphabetical order, by default.


the shell sort command is useful in conjunction with the uniq command (i think it's the uniq command, but it's been a few months since i last used it) - which helps you sort a list into alphabetical order and THEN remove any duplicates which are right next to each other in the list.

As you can see, shell scripting/commands are clearly the easiest way to manage data. Perl is a very strong method which allows a LOT of complexity without too much effort. PHP is probably about half as good as perl. Excel... excel is for not excelling, it's for being average, mundane, run-of-the-mill, and slow, very slow.
witnesstheday is offline
Reply With Quote
View Public Profile
 
Old 01-05-2009, 10:34 AM Re: How to make an A-Z index of site?
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,380
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Quote:
topic

sub-topic entry 1
sub-topic entry 2
should obviously be done with a list.

A definition list <dl> would de semantically correct for a book index

to get the links, run Xenu's Link Sleuth on the site and use the list it creates to populate the database.

All that it needs then is some code to read the DB in alpha order and create your site map. As the code reads the DB it can go and get the document title and maybe the meta description to display on the page.
Obviously though - It can't be done using HTML.

If your site supports PHP & MySql look at using PhpDig, Sphider or Sphider-plus to index your own site
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to How to make an A-Z index of site?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.27441 seconds with 12 queries