Alright, I’m creating a site for a local band. I’ve decided to create a system where he (the webmaster - also lead guitarist) has the site, and a bunch of .txt files that will load into them. By having the txt files set as a bunch of html code, he can format it as he wishes and get colours and italics and what not.
Well, for the news section, instead of loading one MASSIVE file, of all the bands doings, it will be one text file per entry with two variables, one for the news, one for the date.
each .txt file has a numbered name, 1 being the first 10 (for example) the most recent. I have another txt file that has the number of entries. Simply, the thing loads the file, and then takes the top number as the most recent, genius huh?
well, kinda. I’m having a bit of trouble with the strings. What the hell am I doing wrong? I’m sure its a simple answer.
loadtotal = new LoadVars();
loadtotal.load("total-number.txt");
loadtotal.onLoad = function() {
loadText = new LoadVars();
loadText.load((loadtotal add ".txt")); //--this is the trouble area I am sure.
loadText.onLoad = function() {
one.text = this.news;
two.text = this.updates;
};
};
Jubba: well, currently its just txt. If I put it in HTML 1.0, and turn on render as HTML on the text box, then it should display as html
Ahmed: I did that because I used kirupa’s tutorial and realised that this new loadvars is only to be executed AFTER the thing has loaded. but do you think it might be the cause of the problem?
Thanks claudio! well, it loaded the file, which is good, I got it to do that.
I’ll reword my problem:
Ok, first off, I load a variable containing the total number of posts:
loadtotal = new LoadVars();
loadtotal.load("total-number.txt");
loadtotal.onLoad = function() {
three.text = this.total;
total = this.total;
};
This works. No problems there. Next, I want to load the most recent item of news (which is the text file with the highest number as it’s file name) so, that would be someting like this: