Daniel,
I'm not a good programmer enough to know what's wrong with your code just with
those informations (it looks OK to me).
When I want to debug my code with php I do the following :
- run the php page
- right click on the page and view source
- try to locate in the HTML source where php inserts the computed content and
see what's wrong there.
I don't know from what you say if the php executes correctly, or if the HTML is
wrong or if there is a problem with the way jmol scripts are sent to jmol ?
Paul
Le 7 août 2011 à 13:14, Daniel Carbajo a écrit :
> Thanks for the fast response Paul, I use floating boxes and a php function
> called centerbox to echo the contents of $JMOL, so it actually looks like
> this:
> $title1="Jmol view";
> $JMOL = "<script type=\"text/javascript\">
> jmolInitialize(\"Jmol-12new\", true);
> jmolSetAppletColor(\"white\");
> var jmolcmds = [
> \"load $jmolfile\",
> \"set frank off; select all; hbonds off; spin off; wireframe
> off; spacefill off; trace off; set ambient 40; set specpower 40; slab off;
> ribbons off; cartoons off; label off; monitor off\",
> \"set isosurfacePropertySmoothing TRUE\",
> ...
> \"script Jmol-12new/myJMOLfunctions.spt\",
> \"javascript appletLoaded()\"
> ];
> jmolApplet([450,450], jmolcmds.join(\"; \"));
> </script>";
>
> $JMOL .= "<form><script>jmolButton(\"reset\", \"Original orientation\");
> jmolButton(\"move 360 0 0 0 0 0 0 0 20\", \"Rotate X axis\");
> jmolButton(\"move 0 360 0 0 0 0 0 0 20\", \"Rotate Y axis\");
> jmolButton(\"write image.png\", \"Create image\");
> </script></form>";
> centerbox($title1, $JMOL "#996666");
>
> ...where centerbox is:
> function centerbox( $title, $contenuto, $color ) {
> echo "<div class=\"center_box borderbox\">\n".
> "<h2 style=\"background-color:$color; border-bottom : #5C5E5F
> 2px solid;\"><span> $title </span></h2>".
> "<div class=\"content\"> \n".
> $contenuto.
> "</div></div>";
> }
>
>
> In any case, I want a "Restore" button just beneath the other buttons, or,
> even better, to run $ESTADO directly with JmolScript and no clicking... I
> have tried several ways, including the one you suggest, but it does
> nothing... any clue? So how do I use $ESTADO (which is correct in terms that
> it includes all the information as I have echoed it) to restore the state?
> Thanks!
>
>
> 2011/8/7 Paul Pillot <[email protected]>
> There's a problem with your php.
> A php file can be a standard html file with php code parts included between
> <?php ?> tags.
> If you set your php in a variable a $JMOL, then you don't have to use the
> <?php ?> syntax so the first option is the good one.
> But I think there is something wrong in the statement of your first line with
> the quotes you use, either simple or double ones. You should use
> $JMOL .= '<script>jmolButton('''.$ESTADO.'", "RESTORE");</script>';
> Try to debug that in php (echo $JMOL) and look at what it looks like in the
> resulting HTML code. If your HTML is correct then the problem might be with
> the script you pass to Jmol.
> Paul
>
> Le 7 août 2011 à 12:41, Daniel Carbajo a écrit :
>
>> OK I am completely lost with this actually... I am sorry for being quite
>> dumb but I just don't get it.
>> I already have the output of jmolGetPropertyAsString("stateInfo") in a PHP
>> variable called $ESTADO in my Second PHP Page (where I have to restore the
>> state), so how do I actually restore the state using that variable? I have
>> tried the following with 0 success:
>> $JMOL .= '<script>jmolButton(\''.$ESTADO.'\', "RESTORE");</script>';
>> $JMOL .= '<script>jmolButton("<?php echo $ESTADO; ?>", "RESTORE");</script>';
>>
>> The above don't work so how should I actually do it? Thanks for all this
>> help and sorry again for being quite slow with this...
>> Daniel
>
>
> ------------------------------------------------------------------------------
> BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
> The must-attend event for mobile developers. Connect with experts.
> Get tools for creating Super Apps. See the latest technologies.
> Sessions, hands-on labs, demos & much more. Register early & save!
> http://p.sf.net/sfu/rim-blackberry-1
> _______________________________________________
> Jmol-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jmol-users
>
>
> ------------------------------------------------------------------------------
> BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
> The must-attend event for mobile developers. Connect with experts.
> Get tools for creating Super Apps. See the latest technologies.
> Sessions, hands-on labs, demos & much more. Register early & save!
> http://p.sf.net/sfu/rim-blackberry-1_______________________________________________
> Jmol-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jmol-users
------------------------------------------------------------------------------
BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts.
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos & much more. Register early & save!
http://p.sf.net/sfu/rim-blackberry-1
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users