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.

Coding Forum


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



Reply
How to auto-generate alot of HTML files?
Old 04-21-2004, 06:45 PM How to auto-generate alot of HTML files?
Novice Talker

Posts: 5
Trades: 0
I'm building a guitar tab website and I have about 20,000 individual tab files and I need to be able to create an HTML file for each tab file.

The tabs are located on my computer like this for example:

C:\bands\b\beatles\beatles-yesterday.txt

and on my server like this:

www.mydomain.com/b/beatles/beatles-yesterday.txt

The thing that makes this a little difficult is that I need to be able to EXTRACT the file name of each tab (such as beatles-yesterday.txt) and add it to the title tag's and link structure of each html file...

So the end result for this example tab would look like this:

<title>My Sites Name -> Guitar Tabs -> Beatles -> Yesterday tab</title>

Notice how it took the file name and added it to the title tag.

Also, within the tab there would be links that say:

<a href=http://www.mydomain.com>Guitar tabs</a>
<a href=http://www.mydomain.com/b/>Guitar tabs -> B</a>
<a href=http://www.mydomain.com/b/beatles/>Guitar tabs -> B -> Beatles</a>

Then the tab itself would follow.

Does anyone know to go about doing this?

Never done anything like this before, and have no idea how to do it.
Tabble is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 04-21-2004, 11:35 PM
Christopher's Avatar
Iced Cap

Latest Blog Post:
Cross-domain AJAX with JSONP
Posts: 3,110
Location: Toronto, Ontario
Trades: 0
You can use a server side progamming language (PHP, Perl for *nix or ASP, ASP.NET for Windows -- most likely).

You would read the contents of /b/, and then in turn read the contents of each directory under /b/. Extracting the name from the file isn't too hard at all.

If your interested in doing it yourself you can have a look at these PHP functions that will help you along:
  • http://php.net/manual/en/function.readdir.php - Read contents of dirs
  • http://php.net/manual/en/function.explode.php - Split strings. For example, beatles-yesterday.txt you could explode the '-' to get yesterday.txt, then work with another string function to rid the extension
  • http://php.net/manual/en/function.str-replace.php - Might be useful. Example, replace '.txt' with '' (nothing) to get rid of the extension
  • http://php.net/manual/en/function.substr.php - This also might be useful
  • http://php.net/manual/en/function.ucwords.php - Useful to capitalization on words. So 'yesterday' would become 'Yesterday' and 'tomorrow never dies' becomes 'Tomorrow Never Dies' etc.
__________________

Please login or register to view this content. Registration is FREE
- Latest Articles:
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

Christopher is offline
Reply With Quote
View Public Profile
 
Old 04-22-2004, 04:52 AM
Average Talker

Posts: 15
Trades: 0
The best choise is to push your tab files to database (e.g. to MySQL table) and to generate pages of your web site with CGI or PHP script. It could be easily done by a simple program.

The benefits of this method are:

1. High level of security
2. High speed of page generation
3. Easy interface improvoments like search option (it is easier to search in SQL database than in file system)
4. Easy and controlled database growth

Disadvantages:

1. You have to set up SQL server (but is is easy)

The other method is to write simple PHP or CGI script that makes HTML code from tab files.

Benefits:

1. You do not have to setup SQL server and to know SQL

Disadvantages:

1. Potential security hole in filename procesing (if you will not pre-generate directory index)
2. It will be hard to add serach and statistics cappabilities on your site.

And the last method is to use a simple tool to convert yor TAB files to HTML form

Benefits:

1. You will get VERY simple site that does not require even CGI or PHP hosting.
2. It will be fast and secure.

Disadvantages:

1. It will be REALY hard to make even simple modifitaction on all pages.
2. You may forget about search function at all :-)

The choise is on you.

P.S. I can easily write tool for 3rd (the last) method for you if we will place a small link "Generated by tool ordered at www.mh-sd.com" at the bottom of tab pages.
__________________
Software outsourcing / Free bulletin board, hit counter and banner exchange services

Please login or register to view this content. Registration is FREE
Masterhard is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to How to auto-generate alot of HTML files?
 

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.29435 seconds with 12 queries