PHP text fileness

Once again, this has probably been asked numerous time before but I don’t exactly know what this is called or how I would go about searching for it. So sorry for that one.

What I want to do is have all the information on one of my pages be drawn from a txt file through php. I’m doin it all in html, no flash. So if you can point me to a tutorial or just tell me the code it would be great. I’m sure its relatively easy and everything, I’m just new to all of this.
Thanks in advance

-xxviii

what do you mean by ‘drawn’? :slight_smile:

if you just wanted the text to be included in your html file from a text file, use this

<?php include 'file.txt' ?>

et voila… whatever in the text file will appear in the html… :slight_smile:

[size=1]i think i missunderstood you though… did i :q:[/size]

no, thats probably it, i knew it was excessively simple, let me test it out real quick and I’ll tell you

yup, that was exactly what I needed
thanks a lot

can I use HTML tags in the txt file?
or if not can you direct me to a site or something that talks about formatting…

thanks a lot again

Yep! :slight_smile:

yup… i figured that out hella fast, my page looks better now too, thanks a lot

:wink:

if i can just ask, what did this do

did you write you site in the .txt file then use

<?php include 'file.txt' ?>

to display it on your site

ok another question… I want to randomlly load up an image onto my site… what I want to do is have a file such as image.txt have information like this

image 1.jpg
image 2.jpg
image 3.jpg

(that would be in proper html, thats just an example)

I then want to just have it randomly select a line and display the html code… i know its possible because ive seen a few examples, but couldnt figure them out…
so if you could tell me how to do that as well it would be great
thanks a ton

the ‘include’ is a php function that includes any kind of files in the script… what the script above does is merely display the contents of the textfile in the html file the script is embedded into…

oh… sorry, i wasnt clear
i got the other thing to work out, this is a whole different problem, i just didnt want to create a new thread

lol… that was for chris :stuck_out_tongue:

anyways, this thread might help you
http://www.kirupaforum.com/forums/showthread.php?s=&threadid=21058&highlight=*random+image*

hrmm… im still confused… i guess ill just do javascript for now

ok… what i would do is create an array will are the image files like this:

<?php
$images[0] = 'image1.php';
$images[1] = 'image2.php';
$images[2] = 'image3.php';
$images[3] = 'image4.php';
$images[4] = 'image5.php';
?>

and then have this in the html:

<img src="<php? $rand = rand(0,4);
echo $images[$rand];
?>" ></img>

thanks ahmed, but i already got it with javascript… but I think I’ll give yours a shot too to see which one i like better
thanks for bein so helpful

lol… no problem :wink:
for an effect like this one i would use JS, it’s client side… theres no need to get the server invloved in generating a random image you know :slight_smile:

ohh ok
i never understood client and server side but now that i think about it its pretty obvious… i guess php would be kind of overkill… thanks again times a miilion, btw, your site with asian person looks pretty cool

lol :beam:…

I do what i can :stuck_out_tongue:

*the asian person would b me…:slight_smile:

yes it would