[Xerte] Re: rootIcon.loadIcon() - getting it working with xml

Dave Burnett d_b_burnett at hotmail.com
Tue Dec 6 14:23:11 GMT 2011



The evil eval!


Date: Tue, 6 Dec 2011 14:21:27 +0000
From: johnathan.kemp at ntlworld.com
To: xerte at lists.nottingham.ac.uk
Subject: [Xerte] Re: rootIcon.loadIcon() - getting it working with xml

Thank you Julian, once again.

That's another fine mess you've got me out of!
Kind regards
Johnathan

On 6 December 2011 09:23, Julian Tenney <Julian.Tenney at nottingham.ac.uk> wrote:








Fay is right: you are getting the string "FileLocation + 'media/file.jpg'", you need to evaluate it.
 
myPath = expression(templateData.pageName[0].icon, engine); //substitute your page name / attribute name
debug(myPath);
 


From: xerte-bounces at lists.nottingham.ac.uk [xerte-bounces at lists.nottingham.ac.uk] On Behalf Of Kemp Johnathan [johnathan.kemp at ntlworld.com]


Sent: 05 December 2011 22:19

To: Xerte discussion list

Subject: [Xerte] rootIcon.loadIcon() - getting it working with xml






The Xerte help specifies 






rootIcon.loadIcon(FileLOcation + 'media/icon.png');




as the way to call loadIcon, but how do you use it when you don't want to hard code the file name?





I have an xwd based form that collects the url value as

"FileLocation + 'media/bannerTest1.png'"





In my script I have tried





rootIcon.loadIcon(templateData.learningObject[0].projDisplay[0].logoUrl);





which fails, even though




debug(
templateData.learningObject[0].projDisplay[0].logoUrl
);





outputs 





FileLocation + 'media/bannerTest1.png'





I have tried tests such as 





fred = "media/bannerTest1.png";

rootIcon.loadIcon(FileLocation + "'" + fred + "'");



and



fred = "'media/bannerTest1.png'";

rootIcon.loadIcon(FileLocation + fred);




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.




i.e.


rootIcon.loadIcon(FileLocation + 'media/bannerTest1.png');





works.





I cannot get the image to display when the path is passed in a variable.



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.





Can anyone suggest a way forward?





Kind regards





Johnathan











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.





_______________________________________________

Xerte mailing list

Xerte at 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.







_______________________________________________
Xerte mailing list
Xerte at 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. 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nottingham.ac.uk/pipermail/xerte/attachments/20111206/a63e9210/attachment-0001.html>


More information about the Xerte mailing list