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

Fay Cross Fay.Cross at nottingham.ac.uk
Mon Dec 5 23:07:51 GMT 2011


Julian solved something similar for me last week with expression(templateData.table[0].url, this); instead of just templateData...

________________________________________
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




More information about the Xerte mailing list