We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › processing and php
Page Index Toggle Pages: 1
processing and php (Read 301 times)
processing and php
Mar 2nd, 2009, 8:51pm
 
Hello

I'm new to all this.  So be easy!

I'm trying to follow this tutorial...

http://www.learningprocessing.com/tutorials/php/php-persistence/

1. So i've got the php file and the saved.txt file on the server.  Where do i put the processing files (after having exported them?)

2. Also it says " text file to world readable and writable" i guess this means that in my ftp program (im using transmit on a mac) i right click, get info then tick the read, write boxes?

Thanks
Re: processing and php
Reply #1 - Mar 2nd, 2009, 10:50pm
 
1) After exporting, you have an HTML file and other files (at least a .jar). Put them where needed on the Web site. It is independent of the location of the PHP script.
2) Yes. "world" means everybody can read and write, not only your group or only the owner.
Re: processing and php
Reply #2 - Mar 2nd, 2009, 10:54pm
 
many thanks.  


ill probably have more questions soon Smiley
Re: processing and php
Reply #3 - Mar 3rd, 2009, 3:55pm
 
Hi, I just tried again.  I put all files into the one folder onto the server, changed the permissions of the saved.txt file (so that it is all read and writeable by ..global).

But nothing is appearing

my files are here

http://imd.dundee.ac.uk/~kchung/php
which include  

index.html
loading.gif
loadstrings.php
php.jar
php.java
php.pde
saved.txt

I'm sure im missing something fundamental.

thanks
Re: processing and php
Reply #4 - Mar 3rd, 2009, 5:18pm
 
http://www.learningprocessing.com/php/loadstrings.php
should be replaced by
http://imd.dundee.ac.uk/~kchung/php/loadstrings.php

You don't want to use another site to do this job... Smiley
Beside, you just cannot, unless you sign the applet.
No need to sign if the PHP script is on the same server as the applet.
Re: processing and php
Reply #5 - Mar 3rd, 2009, 5:33pm
 
i think thats what i already have... this is the code in the processing file


void setup() {
 size(600,200);
 background(255);
 smooth();
 loadData();
}

void draw() {
 noLoop();
}

void mousePressed() {
 String[] lines = loadStrings("imd.dundee.c.uk/~kchung/php/loadstrings.php?type=save&x=" + mouseX + "&y="+mouseY);
 println(lines[0]);
 loadData();
 redraw();
}

void keyPressed() {
 String[] lines = loadStrings("imd.dundee.c.uk/~kchung/php/loadstrings.php?type=clear");
 println(lines[0]);
 loadData();
 redraw();
 
}

void loadData() {
 background(255);
 String[] lines = loadStrings("imd.dundee.c.uk/~kchung/php/loadstrings.php?type=load");
 beginShape();
 stroke(0);
 noFill();
 for (int i = 0; i < lines.length; i++) {
   int[] vals = int(split(lines[i],","));
   if (vals.length > 1) {
     vertex(vals[0],vals[1]);
   }
 }
 endShape(CLOSE);
 for (int i = 0; i < lines.length; i++) {
   int[] vals = int(split(lines[i],","));
   if (vals.length > 1) {
     rectMode(CENTER);
     stroke(0);
     fill(175);
     rect(vals[0],vals[1],10,10);
   }
 }
}

Re: processing and php
Reply #6 - Mar 3rd, 2009, 6:02pm
 
That's not what I saw in the php.pde file on your site.
Beside, you have to specify an absolute address, with http://
Re: processing and php
Reply #7 - Mar 3rd, 2009, 6:08pm
 
hi, i added the http and ...still not doing anything Sad
Re: processing and php
Reply #8 - Mar 3rd, 2009, 6:26pm
 
Nevermind, i got it working finally Smiley

Thanks for your help

Think i just over complicated something really simple >_>
Page Index Toggle Pages: 1