PDA

View Full Version : Actionscript+PHP help needed



Entity_Razer
01-25-2007, 01:47 AM
Got a little problem. I know to parse a normal PHP file and load the text out of it but i got the following "problem"

i'd like to put all my text into 1 single PHP file ( its for a flash site for school, and i'm going to load the text out of the PHP file)

Thing is right know i only know how to load Entire text from 1 file, what i'd like to do is put all the text into one single PHP Array or into vars and only have the text i need outputted.


SO i'm thinking of putting all the text into var's and then using, via the GET command getting only one of the vars echo'd (the one i'd want)

Would this work?

Any advice?

ahmad
02-02-2007, 11:27 PM
That would work but I'd rather create a hashtable or just a regular array and put the filenames in that array. Then based on the value of your GET variable, you load that particular file using the filename in the array.. At least that why you won't have useless string literals in your PHP file.

You can also use the PHP include command if you don't want to do any IO:

<?php

$i = "somefile.txt";

include($i);

?>

Special_K
02-03-2007, 05:56 AM
here's a simple way of doing it

make your php output like this

&var1="This is variable One content."&
&var2="This is variable Two content."&
&var3="This is variable Three content."&
etc
etc

put a textField on the stage and give it an instance name ('myTextfield' say)

after you have loaded the php, and you have chosen which variables you want to display (var1 & var3 say) make an actionscript like this

myTextfield.text = var1 + var3


it would be very long winded to do it like this for 100+ variables, but it will still work

ahmads way would be much better, and is what php/mySQL excels at