logo

  Blog

  Airsoft

  Distributed Comp

  Linux

  Geexbox

  Gaming

  Software

  Links

  Contact Me

  unique hits

  Links


  Web site contents © Copyright TOTMS 2007 Some works released under GPL. These are explicity marked, All rights reserved.

 

HTML linking code parser

So what is it?
Its a very simple command prompt utility written in FreeBasic which quickly generates code which can be used in a program like dreamweaver to index a whole website.

How does it do this?
The program reads a page list from a text file and parses them into a list. This program is specifically designed to deal with pages that have hyphens (e.g. internet-shopping.asp). It separates the two words and generates a link to the page with appropriate anchor text. (See below.) Whilst the program does not generate the complete HTML, (i.e. including head body tags) it would be very easy to implement using a form of template system (i.e. page html code placed in a template.txt file with some region like ##links## placed in for the program to replace with the generated code.) I however use dream weaver at work so this was unnecessary.

What does it currently do?
The program takes a list of pages (in a file a.txt) and processes it generating a table of links. The links are generated in the form below :

content.php
search-page.php
finance-search-results.htm
… etc

Get turned into:

Content
Search Page
Finance Search Results

With the appropriate link to the page. Whilst this may seem trivial, if you are trying to index a site with many pages (I have used this utility on websites with over 1000 pages) it quickly becomes very valuable. In terms of speed, this program generated code (which is placed into output.txt) for around 1,300 files in under a minute so it is very fast. It was my first attempt coding something with the freebasic complier. I have to say I am fairly impressed with it thus far. It of course goes without saying that you should be careful about what you index – you may not want the location of your scripts / xmls etc nested in a site index.

I am also posting the source code to this program in the hope that it will help people who are just starting in freebasic. The site and manual are very good, but there are not many completely FreeBasic code snippets to play with around at the moment that I can find..

Download Current Build
Download Source Code

The source is being released under GPL.

Please note: At the moment the program only works perfectly with three letter extensions e.g. .asp .php .htm . Implementing .html is very easy and if there is demand I will do it, or you can do it yourself.