Harris Procopiou wrote:
> I try to load multiple files but i can't... I 'm working with perl :
>
> print "
> <form>
> <script>
> jmolInitialize("Jmol.js");
> jmolApplet(300, "load "fileset" "1BZ8.pdb"
> "1C26.pdb"; select */2; color red;");
> </script>
> </form>";
>
> The problem is quotes... how can i do this ?
>
> I tried :
>
> print "
> <form>
> <script>
> jmolInitialize("Jmol.js");
> jmolApplet(300, "load 'fileset' '1BZ8.pdb'
> '1C26.pdb'; select */2; color red;");
> </script>
> </form>";
>
> But it does not work too. And :
>
> print "
> <form>
> <script>
> jmolInitialize("Jmol.js");
> jmolApplet(300, load "fileset" "1BZ8.pdb"
> "1C26.pdb"; select */2; color red;);
> </script>
> </form>";
>
> The same..
>
>
Hi Harris,
since you mentioned perl as the script language you are using to create
the HTML code I guess your question refers to the syntax errors you will
get in perl if you try the above 'print' commands.
There are two methods in perl to solve this problem. The first one is to
'escape' the double quotes inside the 'print' statement with a
backslash,e.g.:
print "jmolApplet(300, \"load 'fileset' '1BZ8.pdb' '1C26.pdb'\");";
The disadvantage of this method is that the text is less good readable
and that you have to change the HTML code you might have tested in a
plain HTML text before you started to integrate it into your perl script.
Therefore I prefer the second method: using the general quoting
operator 'qq'.
The above example could look like this:
print qq{jmolApplet(300, "load 'fileset' '1BZ8.pdb' '1C26.pdb");};
You can replace the brace ('{') behind the 'qq' by any other
non-alphanumeric character. Then the end brace ('}') must also be
replaced by the same character (or the corresponding closing bracket
character if you use '(' or '[').
In my work the brace has proven to work in most cases for HTML code.
Regards,
Rolf
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users