Can anyone help me
Hello everyone. I am new to the forum.
I have two questions actually.
1. I want a block of text to change on my website when it is loaded each time and I don't know the best way to handle this.
Can I create a group of .txt files and have them change dynamically?
2. My company wants to put their three magazines online and I want to simplify the process of creating the web pages. I want to set up a form where I can paste the text and when I submit the page it should look how it would on the web.
Gurudev posted this at 03:43 — 17th January 2002.
They have: 61 posts
Joined: Nov 2001
1. You can display any text dynamically on your page, if your host allows "server includes". If you want different text displayed from a group of texts, then you will need a script for this.
2. Can be done in a lot of ways, but need more info. How big are these magazines? Is it just one page or a lot of pages?
Let me know if this is/would be a paid. You can email me or use the pm.
thanks
selie posted this at 03:45 — 17th January 2002.
They have: 8 posts
Joined: Jan 2002
Actually the magazine is very large, consisting of atleast 30 articles per monthly issue.
Wil posted this at 09:57 — 17th January 2002.
They have: 601 posts
Joined: Nov 2001
Hi
1. This is easy. In Perl, something like this would do the trick nicely. Perl is know for it's speed in file-handling.
sub generate_random_text {
open (RANDOM,"<$RANDOM_FILE") || die("Could not open $RANDOM_FILE $!");
@allrandom = <RANDOM>;
close(RANDOM);
$phrases = join('',@allrandom);
@phrases = split(/%%/,$phrases);
$random_text = $phrases[int rand @phrases];
return $random_text;
}
You would then create a text file with your blocks of text in, each deliminated by a %%. This is a quick sample of how your file might look:
Random Text
%%
Another Random Text
%%
And another one
2. Yes this is also possible. I assume you're looking to create a template, and then drop in plain text on a form and this will create a file out of your templates? I've actually got a code similar to this already if you're interested. It would obviously need to be customised heavily, so give me a shout if interested.
- wil
yabber posted this at 12:48 — 17th January 2002.
They have: 93 posts
Joined: Dec 2001
Also you can do this using php includes
<? include("/path/to/text.txt")?>
then eveytime you update/change the text file it is shown on the page
Mika
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.