<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
</head>
<body class='hmmessage'><div dir='ltr'>
<br>The evil eval!<br><br><br><div><hr id="stopSpelling">Date: Tue, 6 Dec 2011 14:21:27 +0000<br>From: johnathan.kemp@ntlworld.com<br>To: xerte@lists.nottingham.ac.uk<br>Subject: [Xerte] Re: rootIcon.loadIcon() - getting it working with xml<br><br><div>Thank you Julian, once again.<br></div><div><br></div><div>That's another fine mess you've got me out of!</div><div><br></div><div>Kind regards</div><div><br></div><div>Johnathan</div><br><div class="ecxgmail_quote">
On 6 December 2011 09:23, Julian Tenney <span dir="ltr"><<a href="mailto:Julian.Tenney@nottingham.ac.uk">Julian.Tenney@nottingham.ac.uk</a>></span> wrote:<br><blockquote class="ecxgmail_quote" style="border-left:1px #ccc solid;padding-left:1ex">
<div>
<div style="font-family:Tahoma;direction:ltr;color:#000000;font-size:x-small">
<div>Fay is right: you are getting the string "FileLocation + 'media/file.jpg'", you need to evaluate it.</div>
<div> </div>
<div><font face="tahoma">myPath = expression(templateData.pageName[0].icon, engine); //substitute your page name / attribute name</font></div>
<div><font face="tahoma">debug(myPath);</font></div><div class="ecxim">
<div dir="ltr"> </div>
<div style="direction:ltr">
<hr>
<font color="#000000" size="2" face="Tahoma"><b>From:</b> <a href="mailto:xerte-bounces@lists.nottingham.ac.uk">xerte-bounces@lists.nottingham.ac.uk</a> [<a href="mailto:xerte-bounces@lists.nottingham.ac.uk">xerte-bounces@lists.nottingham.ac.uk</a>] On Behalf Of Kemp Johnathan [<a href="mailto:johnathan.kemp@ntlworld.com">johnathan.kemp@ntlworld.com</a>]<br>
<b>Sent:</b> 05 December 2011 22:19<br>
<b>To:</b> Xerte discussion list<br>
<b>Subject:</b> [Xerte] rootIcon.loadIcon() - getting it working with xml<br>
</font><br>
</div>
</div><div><div class="h5"><div>
<div>The Xerte help specifies <br>
</div>
<div><br>
</div>
<div>
<div align="left"><font size="2" face="Andale Mono"><span style="font-size:10pt">rootIcon.<font style="background-color:#0a246a" color="#ffffff">loadIcon</font>(FileLOcation + 'media/icon.png');</span></font></div>
<div align="left"><font size="2" face="Andale Mono"><span style="font-size:10pt"><br>
</span></font></div>
<div align="left"><font size="2" face="Andale Mono"><span style="font-size:10pt">as the way to call loadIcon, but how do you use it when you don't want to hard code the file name?<br>
</span></font></div>
<div align="left"><font size="2" face="Andale Mono"><span style="font-size:10pt"><br>
</span></font></div>
<div align="left"><font size="2" face="Andale Mono"><span style="font-size:10pt">I have an xwd based form that collects the url value as
</span></font></div>
<div align="left"><font size="2" face="Andale Mono"><span style="font-size:10pt">"FileLocation + 'media/bannerTest1.png'"<br>
</span></font></div>
<div align="left"><font size="2" face="Andale Mono"><span style="font-size:10pt"><br>
</span></font></div>
<div align="left"><font size="2" face="Andale Mono"><span style="font-size:10pt">In my script I have tried<br>
</span></font></div>
<div align="left"><font size="2" face="Andale Mono"><span style="font-size:10pt"><br>
</span></font></div>
<div align="left"><font size="2" face="Andale Mono"><span style="font-size:10pt">rootIcon.loadIcon(templateData.learningObject[0].projDisplay[0].logoUrl);<br>
</span></font></div>
<div align="left"><font size="2" face="Andale Mono"><span style="font-size:10pt"><br>
</span></font></div>
<div align="left"><font size="2" face="Andale Mono"><span style="font-size:10pt">which fails, even though
</span></font></div>
<div align="left"><font size="2" face="Andale Mono"><span style="font-size:10pt"><br>
</span></font></div>
<div align="left"><font size="2" face="Andale Mono"><span style="font-size:10pt">debug(</span></font>
<font size="2" face="Andale Mono"><span style="font-size:10pt">templateData.learningObject[0].projDisplay[0].logoUrl</span></font>
<font size="2" face="Andale Mono"><span style="font-size:10pt">);<br>
</span></font></div>
<div align="left"><font size="2" face="Andale Mono"><span style="font-size:10pt"><br>
</span></font></div>
<div align="left"><font size="2" face="Andale Mono"><span style="font-size:10pt">outputs <br>
</span></font></div>
<div align="left"><font size="2" face="Andale Mono"><span style="font-size:10pt"><br>
</span></font></div>
<div align="left"><font size="2" face="Andale Mono"><span style="font-size:10pt">FileLocation + 'media/bannerTest1.png'<br>
</span></font></div>
<div align="left"><font size="2" face="Andale Mono"><span style="font-size:10pt"><br>
</span></font></div>
<div align="left"><font size="2" face="Andale Mono"><span style="font-size:10pt">I have tried tests such as <br>
</span></font></div>
<div align="left"><font size="2" face="Andale Mono"><span style="font-size:10pt"><br>
</span></font></div>
<div align="left"><font size="2" face="Andale Mono"><span style="font-size:10pt">fred = "media/bannerTest1.png";<br>
rootIcon.loadIcon(FileLocation + "'" + fred + "'");</span></font></div>
<div align="left"><font size="2" face="Andale Mono"><span style="font-size:10pt"><br>
</span></font></div>
<div align="left"><font size="2" face="Andale Mono"><span style="font-size:10pt">and</span></font></div>
<div align="left"><font size="2" face="Andale Mono"><span style="font-size:10pt"><br>
</span></font></div>
<div align="left"><font size="2" face="Andale Mono"><span style="font-size:10pt">fred = "'media/bannerTest1.png'";<br>
rootIcon.loadIcon(FileLocation + fred);<br>
</span></font></div>
<div align="left"><font size="2" face="Andale Mono"><span style="font-size:10pt"><br>
In an attempt to figure out what hoops I will have to go through to get it to work, but the only way I can get the image to display is if I hard code it into the script.
</span></font></div>
<div align="left"><font size="2" face="Andale Mono"><span style="font-size:10pt"><br>
</span></font></div>
<div align="left"><font size="2" face="Andale Mono"><span style="font-size:10pt">i.e.<br>
</span></font></div>
<div align="left"><font size="2" face="Andale Mono"><span style="font-size:10pt">rootIcon.loadIcon(FileLocation + 'media/bannerTest1.png');<br>
</span></font></div>
<div align="left"><font size="2" face="Andale Mono"><span style="font-size:10pt"><br>
</span></font></div>
<div align="left"><font size="2" face="Andale Mono"><span style="font-size:10pt">works.<br>
</span></font></div>
<div align="left"><font size="2" face="Andale Mono"><span style="font-size:10pt"><br>
</span></font></div>
<div align="left"><font size="2" face="Andale Mono"><span style="font-size:10pt">I cannot get the image to display when the path is passed in a variable.</span></font></div>
<div align="left"><font size="2" face="Andale Mono"><span style="font-size:10pt"><br>
</span></font></div>
<div align="left"><font size="2" face="Andale Mono"><span style="font-size:10pt">I don't know if the issue is something to do with FileLocation converting to a path with back slashes whilst the media/bannerTest1.png has a forward slash, but this hasn't stopped
the method call working when I hard code the file name.<br>
</span></font></div>
<div align="left"><font size="2" face="Andale Mono"><span style="font-size:10pt"><br>
</span></font></div>
<div align="left"><font size="2" face="Andale Mono"><span style="font-size:10pt">Can anyone suggest a way forward?<br>
</span></font></div>
<div align="left"><font size="2" face="Andale Mono"><span style="font-size:10pt"><br>
</span></font></div>
<div align="left"><font size="2" face="Andale Mono"><span style="font-size:10pt">Kind regards<br>
</span></font></div>
<div align="left"><font size="2" face="Andale Mono"><span style="font-size:10pt"><br>
</span></font></div>
<div align="left"><font size="2" face="Andale Mono"><span style="font-size:10pt">Johnathan<br>
</span></font></div>
<div align="left"><font size="2" face="Andale Mono"><span style="font-size:10pt"><br>
</span></font></div>
</div>
</div>
</div></div></div><div class="ecxim">
<br>
This message and any attachment are intended solely for the addressee and may
contain confidential information. If you have received this message in error,
please send it back to me, and immediately delete it. Please do not use,
copy or disclose the information contained in this message or in any attachment.
Any views or opinions expressed by the author of this email do not necessarily
reflect the views of the University of Nottingham.
<BR>
This message has been checked for viruses but the contents of an attachment
may still contain software viruses which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.
<BR>
</div></div>
<br>_______________________________________________<br>
Xerte mailing list<br>
<a href="mailto:Xerte@lists.nottingham.ac.uk">Xerte@lists.nottingham.ac.uk</a><br>
<a href="http://lists.nottingham.ac.uk/mailman/listinfo/xerte" target="_blank">http://lists.nottingham.ac.uk/mailman/listinfo/xerte</a><br>
<br>
This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it. Please do not use, copy or disclose the information contained in this message or in any attachment. Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.<br>
<br>
This message has been checked for viruses but the contents of an attachment<br>
may still contain software viruses which could damage your computer system:<br>
you are advised to perform your own checks. Email communications with the<br>
University of Nottingham may be monitored as permitted by UK legislation.<br>
<br>
<br></blockquote></div><br>
<br>_______________________________________________
Xerte mailing list
Xerte@lists.nottingham.ac.uk
http://lists.nottingham.ac.uk/mailman/listinfo/xerte
This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it. Please do not use, copy or disclose the information contained in this message or in any attachment. Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.
This message has been checked for viruses but the contents of an attachment
may still contain software viruses which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.</div> </div></body>
</html>