Load HTML code from text file upon HTM page load???

LilJohn

Senior Member
Joined
Oct 26, 2007
Messages
657
Reaction score
0
Was wondering if u guys can help me, I want to load HTML code from text file upon page load.

Reason for that is: I have a list of songs which will be in about 100 pages, so should I need to remove one page linked to a particular song from the site I can simply delete the link of that page on the text file instead of going to all the pages and deleting the link there one by one.

Any alternative solutions is welcomed apart from using frames.

Here's an example of the list that will be on about 100 pages.

http://www.mzansigigs.co.za/
 
No need for a db if it's just a list.

Code:
<?php
include "mylistofsongs.txt";
?>

> That's assuming you do have php. Also all your pages will have to be pagename.php so that they can be parsed.
 
Last edited:
No need for a db if it's just a list.

Code:
<?php
include "mylistofsongs.txt";
?>

> That's assuming you do have php. Also all your pages will have to be pagename.php so that they can be parsed.

Just quick question again, I am not to familiar with php code.

Why is it that when I say view source code, I dont see this code: <?php
include "mylistofsongs.txt";
?>
 
What's the include - the stuff in #html1?

Well done there, nice to learn something new. :)

Edit: The php is processed on the server - before it is sent to your browser, the include statement has been replaced with the file you specified.
 
Just quick question again, I am not to familiar with php code.

Why is it that when I say view source code, I dont see this code: <?php
include "mylistofsongs.txt";
?>

Because that would be exposing your source code, your IP, the internal workings of your systems, etc. In other words, it wouldn't be a very good idea.
The PHP code is executed before the HTML page is served up to the browser.
 
it is server side scripting, this way the code is processed by the server and not by the client machine which then generates HTML, unlike local runtime applications like javascript or action script that rely on the client machine for processing.

one of the benefits is protecting IP, but the draw back is can nail your server if it is a popular website.
 
Top
Sign up to the MyBroadband newsletter
X