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 & HelpIntegration › processing & html/php, directory-trouble
Page Index Toggle Pages: 1
processing & html/php, directory-trouble (Read 2544 times)
processing & html/php, directory-trouble
Jan 16th, 2010, 4:58am
 
hi everyone,

maybe this is a very newbish question and i also don't know if the processing forum is the right place for it, but i'm stuck with this little problem here and i hope someone can help me.

i am making a website on which you can navigate through some processing html applets. i use php to make the navigation part. it basically works like this: user clicks on a thumbnail, website is reloaded with php-variable handover and depending on the variable a certain processing html applet is included to the site.
every processing applet is in its own folder and here the trouble starts.

using the php method "include(example1/example1.html);"
includes the processing html file into the php file which is in another directory. so all the relative paths in the processing html file don't work in the new directory. i tried to change all the lines with pathes in the processing html file manually, but i failed Sad

the easiest way to solve this problem would be to temporarily change the path from which the html/php file operates. something like:
"new_directory: example1/;"
so that from than on every path would be relative to "example1".
thats maybe more a html/php question than a processing one.

the other way  would be to change all paths in the processing html file manually. does anyone now which lines that are? as i said, i tried this but it wouldnt work, so i assume i didn't change the right ones

thank you!!

i think i made it sound a lot more complicated than it is, sorry for that Smiley


Re: processing & html/php, directory-trouble
Reply #1 - Jan 16th, 2010, 5:50am
 
You could use frames. I don't like frames, but that would be more simple and you wouldn't have to care about the paths.
Re: processing & html/php, directory-trouble
Reply #2 - Jan 16th, 2010, 7:22am
 
i hate to ask, but what exactly do you mean by frames? i couldn't find it in the reference
Re: processing & html/php, directory-trouble
Reply #3 - Jan 16th, 2010, 7:32am
 
Frames are HTML elements that allow you to embed one HTML page in another.

I edited the link paths in the template HTML that Processing uses to generate the exported content. Its at (processing folder)/lib/applet.html and processing/lib/applet-opengl.html. I believe there are some drawbacks to doing that, but it works okay in most situations.
Re: processing & html/php, directory-trouble
Reply #4 - Jan 18th, 2010, 12:39am
 
thank you!

both ways are working fine, though i prefer to mess around with the processing html file rather than doing it frame-style Smiley
Re: processing & html/php, directory-trouble
Reply #5 - Jan 18th, 2010, 1:24am
 
unfortunately messing around with the html file doesn't work when i have more than one file included in the archive section of the html file. i think it has something to do with opengl


this is (part of) the original html file processing creates:

Code:
<div id="starus_container">

<!--[if !IE]> -->
<object classid="java:com.sun.opengl.util.JOGLAppletLauncher.class"
type="application/x-java-applet"
archive="starus.jar,opengl.jar,jogl.jar,gluegen-rt.jar,core.jar"
width="960" height="720"
standby="Loading Processing software..." >

<param name="archive" value="starus.jar,opengl.jar,jogl.jar,gluegen-rt.jar,core.jar" />

<param name="mayscript" value="true" />
<param name="scriptable" value="true" />

<param name="image" value="loading.gif" />
<param name="boxmessage" value="Loading Processing software..." />
<param name="boxbgcolor" value="#FFFFFF" />
<param name="progressbar" value="true" />

<param name="subapplet.classname" value="starus" />
<param name="subapplet.displayname" value="starus" />

<param name="test_string" value="outer" />
<!--<![endif]-->





and here is my edited version (i tried to do it like shown in "applet-opengl.html"). since the html file is in the folder starus i manually added "starus/" to all sketch and archive paths


Code:
<div id="starus_container">

<!--[if !IE]> -->
<object classid="java:com.sun.opengl.util.JOGLAppletLauncher.class"
type="application/x-java-applet"

// MANUAL EDIT
archive="starus/starus.jar,starus/opengl.jar,starus/jogl.jar,starus/gluegen-rt.jar,starus/core.jar"

width="960" height="720"
standby="Loading Processing software..." >

// MANUAL EDIT
<param name="archive" value="starus/starus.jar,starus/opengl.jar,starus/jogl.jar,starus/gluegen-rt.jar,starus/core.jar" />

<param name="mayscript" value="true" />
<param name="scriptable" value="true" />

<param name="image" value="loading.gif" />
<param name="boxmessage" value="Loading Processing software..." />
<param name="boxbgcolor" value="#FFFFFF" />
<param name="progressbar" value="true" />

// MANUAL EDIT
<param name="subapplet.classname" value="starus/starus" />

// MANUAL EDIT
<param name="subapplet.displayname" value="starus/starus" />

<param name="test_string" value="outer" />
  <!--<![endif]-->


doing so, i get an "error: Start failed: class not found: starus/starus"

i tried quite a few other combinations of adding the folder and not adding it and i either got an error right on the start of loading the applet or i got  "Error: unable to install the native file locally"

does anyone see what i am doing wrong? i think i'm stuck once again...
Re: processing & html/php, directory-trouble
Reply #6 - Jan 18th, 2010, 2:10pm
 
I had some of the same problems.

You should be able to fix it so that it finds your sketches properly, but it might be kind of a pain. There are two sections of applet embed code. One for Internet Explorer and one for everything else. You have to make sure you edit them both correctly if you want your sketches to be displayed right across all browsers.

I haven't exactly tested mine with multiple class files. I have been writing all the classes and main code in one file. I noticed in the section of the default Processing HTML template where source files are linked it apparently puts the links for all source files together in one variable, @@source@@, which I believe makes it impossible to change each of those individually. My source is written as one file and I have modified the link in the template to avoid that problem. You could also provide the source in a zip file.

On my webspace my exported sketches are all in folders with the same name as the sketch. Here is my modified template making use of @@sketch@@ which holds the name of the sketch to be exported:

Non-OpenGL

OpenGL
Re: processing & html/php, directory-trouble
Reply #7 - Jan 21st, 2010, 2:01am
 
i tried your opengl template, that's an interesting approach, but unfortunately i can't get it working.
the source code gets correctly linked (starus/starus.jar). all the other files (opengl.jar,jogl.jar,gluegen-rt.jar,core.jar) are without the path declaration before them. but adding that manually doesn't help either. error message right on the start.

Re: processing & html/php, directory-trouble
Reply #8 - Jan 22nd, 2010, 8:19am
 
i found a good way to integrate processing applets and to avoid all the directionary trouble by using the html tag "iframe".
it lets you integrate whole html files without the drawbacks of the "frame" tag.
Re: processing & html/php, directory-trouble
Reply #9 - Feb 2nd, 2010, 8:34pm
 
Is your site working the way you wanted it to? I'm curious if you ended up changing the paths manually or not, and was wondering if you could show an iframe example?
Re: processing & html/php, directory-trouble
Reply #10 - Feb 3rd, 2010, 1:01am
 
yes the site is pretty much working as i wanted it to.

in the applet html file i only cut out everything outside the 2 div tags that contain the actuall code referencing (so all the head part and the body tag) . so all the html file produces is just the sketch, nothing above, nothing below.
the iframe tag on my website looks like this:
Code:

echo  
'<iframe src="applets/',$link[$index],'"
width="100%" height="',$height[$index]+20,'" name="',$applet[$index],'"
align="left" frameborder="0">
</iframe>';

Re: processing & html/php, directory-trouble
Reply #11 - Feb 3rd, 2010, 1:18am
 
yes the site is pretty much doingwhat i wanted, but i am still working on it.

in the applet html file i only cut out everything outside the 2 div tags that contain the actuall code referencing (so all the head part and the body tag) . so all the html file produces is just the sketch, nothing above, nothing below. i didn't touch the paths and anything else inside the div tags.
the iframe tag on my website looks like this:
Code:

echo  
'<iframe src="applets/',$link[$index],'"
width="100%" height="',$height[$index]+20,'"    name="',$applet[$index],'"
align="left" frameborder="0">
</iframe>';

$link[$index] contains the link of the chosen applet
$height[$index] contains the height of the chosen applet. the +20 is to avoid a scrollbar to the right (because iframe creates a very small margin to the left and to the top, haven't figured out how to change this yet) when you are more into webprogramming than i am you could probably read this information automatically from the processing html file rather than setting it manually like me.
$applet[$index] just contains the name of the applet as a string

doing it this way you can leave all the paths in the applet html file the way they were.
it's all under construction right now but you can take a look at my website at the current state here:
http://www.generalzombie.de/sketchbook/exp2.php

hope you find it useful
Page Index Toggle Pages: 1