reading from a text file... - Post ID...
How can I read text from a text file and have it appear on my webpage? I'm assuming an html box, but I don't know what html or javascript I need to make this work. I tried this and it didn't work (maybe vsd doesn't support php or I have to add a library?):
<?php
$dataFile = file_get_contents("data.txt");
echo $dataFile;
?>
Thanks in advance!
<?php
$dataFile = file_get_contents("data.txt");
echo $dataFile;
?>
Thanks in advance!
Your php script works fine if you create a html file using the CC html Editor and insert the script. The html file needs the file extension .php as you assumed, and that cannot be done in VSD. You also have to upload the files in order to see the text appear, unless you have php installed locally.
Ha en riktig god dag!
Inger, Norway
My work in progress:
Components for Site Designer and the HTML Editor: https://mock-up.coffeecup.com
Inger, Norway
My work in progress:
Components for Site Designer and the HTML Editor: https://mock-up.coffeecup.com
Thanks! I'll have to find another way as I'm doing the website in vsd...
Maybe an iframe would be a solution? Insert this using the html tool:
<iframe width="800" height="400" src="data.txt"></iframe>
You can adjust the height and width to match the size of your txt file
<iframe width="800" height="400" src="data.txt"></iframe>
You can adjust the height and width to match the size of your txt file
Ha en riktig god dag!
Inger, Norway
My work in progress:
Components for Site Designer and the HTML Editor: https://mock-up.coffeecup.com
Inger, Norway
My work in progress:
Components for Site Designer and the HTML Editor: https://mock-up.coffeecup.com
hehehe....that's what I was just expirementing with. Thanks!
(Actually, the problem is harder because I want to load the file, fill up an array with it probably delimiting elements by tab or comma and access members of the array). Since this has little to do with VSD I'll check on html editor... Thanks again!
(Actually, the problem is harder because I want to load the file, fill up an array with it probably delimiting elements by tab or comma and access members of the array). Since this has little to do with VSD I'll check on html editor... Thanks again!
Well, with such content I guess you'll have to go php, not sure if it can be done with js. I'm not particularly well versed in either, but I THINK, if you can find a js solution, you may still be able to use VSD.
Ha en riktig god dag!
Inger, Norway
My work in progress:
Components for Site Designer and the HTML Editor: https://mock-up.coffeecup.com
Inger, Norway
My work in progress:
Components for Site Designer and the HTML Editor: https://mock-up.coffeecup.com
Maybe do one html/php page in the editor, upload to server, then put a link to it in the VSD site (and a link back to the VSD site on the php page?
I love deadlines. I like the whooshing sound they make as they fly by. (Douglas Adams)
https://www.callendales.com
https://www.callendales.com
I found one way which works nicely and thought I'd pass it along.
In the page header I put:
<script type = "text/javascript" src="mydata.txt"></script>
The file "mydata.txt" can define variables which will be valid on the page. For example, mydata.txt could be:
//context of mydata.txt file // file extension may be .js or .txt
mydata1 = "The quick brown ";
mydata2 = "fox jumps over ";
mydata3 = "the lazy dog";
// end of text file
Then in an html box you can put:
<script type = "text/javascript">
{
document.write(mydata1 + mydata2 + mydata3);
}
</script>
This overcomes the entry problem I was having with certain characters. Also opens up the possibility of supporting multiple languages on a single page (rather than having to write a new page for each language...)
In the page header I put:
<script type = "text/javascript" src="mydata.txt"></script>
The file "mydata.txt" can define variables which will be valid on the page. For example, mydata.txt could be:
//context of mydata.txt file // file extension may be .js or .txt
mydata1 = "The quick brown ";
mydata2 = "fox jumps over ";
mydata3 = "the lazy dog";
// end of text file
Then in an html box you can put:
<script type = "text/javascript">
{
document.write(mydata1 + mydata2 + mydata3);
}
</script>
This overcomes the entry problem I was having with certain characters. Also opens up the possibility of supporting multiple languages on a single page (rather than having to write a new page for each language...)
Good job!
Also, if you ever find yourself needing php in the future, VSD saves and updates html files in the folder marked the same name as your .vnu website file within the same parent folder of that file. All you gotta do is change the .html to .php and upload manually or with ftp.
Also, if you ever find yourself needing php in the future, VSD saves and updates html files in the folder marked the same name as your .vnu website file within the same parent folder of that file. All you gotta do is change the .html to .php and upload manually or with ftp.

Aren't you a little short for a Storm Trooper?
Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.