How do you put a TXT file on HTML?
inna last edited by
There's a HTML page. This part of the code (iframe cannot be inserted here):
<iframe id="test" src="link" frameborder="0" width="100%"></iframe>
I need to make a difference.
linkWent out of the link.txt, in the form of a random line. link.txt is in the same directory with the HTML file.
The link.txt file will be 9 lines with URL links and one line with the variable that takes the value from the general_links.txt file in the root folder. One random line from the file.
I know you need to process PHP or JS, but you can't.
<?php $f = file("link.txt"); $random_line = $f[rand(0, count($f) - 1)]; ?> <iframe id="test" src="<?php echo $random_line; ?>" frameborder="0" width="100%"></iframe>
Also worth adding the URL correction check
filter_var($random_line, FILTER_VALIDATE_URL);(in the code above, I didn't insert this line because I don't know what you want to do if URL is incorrect).