Saturday, March 27, 2010

spry:repeat works in Mozilla and not IE...

I made this little test in Spry.
It happens to work in Mozilla but not in Internet Explorer 6
which is quite weird since I almost copy/pasted from one of the
included examples (the example worked fine everywhere).



Can anyone point me in the right direction please?



Thanks...





%26lt;!DOCTYPE html PUBLIC ''-//W3C//DTD XHTML 1.0
Transitional//EN'' ''
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd''%26gt;

%26lt;html xmlns=''
http://www.w3.org/1999/xhtml''
xmlns:spry=''
http://ns.adobe.com/spry''%26gt;

%26lt;head%26gt;

%26lt;title%26gt;Club voleibol bargas%26lt;/title%26gt;

%26lt;meta http-equiv=''Content-Type'' content=''text/html;
charset=iso-8859-1'' /%26gt;



%26lt;script language=''JavaScript'' type=''text/javascript''
src=''scripts/spry/xpath.js''%26gt;%26lt;/script%26gt;

%26lt;script language=''JavaScript'' type=''text/javascript''
src=''scripts/spry/SpryData.js''%26gt;%26lt;/script%26gt;



%26lt;script language=''JavaScript'' type=''text/javascript''%26gt;

var dsNews = new
Spry.Data.XMLDataSet(''scripts/xml_noticias.php'', ''/allnews/news'');

%26lt;/script%26gt;

%26lt;/head%26gt;



%26lt;body%26gt;



%26lt;div spry:region=''dsNews''%26gt;

%26lt;div spry:repeat=''dsNews''%26gt;{header}%26lt;/div%26gt;

%26lt;/div%26gt;



%26lt;/body%26gt;



%26lt;/html%26gt;



















The XML needed for this looks like this:



%26lt;allnews%26gt;

%26lt;news%26gt;

%26lt;id%26gt;26%26lt;/id%26gt;

%26lt;header%26gt;Morbi mauris.%26lt;/header%26gt;

%26lt;/news%26gt;

%26lt;news%26gt;

%26lt;id%26gt;23%26lt;/id%26gt;

%26lt;header%26gt;Lorem ipsum dolor sit amet%26lt;/header%26gt;

%26lt;/news%26gt;

%26lt;news%26gt;

%26lt;id%26gt;8%26lt;/id%26gt;

%26lt;header%26gt;Proin convallis. Duis sed est ut ligula
ullamcorper bibendum.%26lt;/header%26gt;

%26lt;/news%26gt;

%26lt;/allnews%26gt;spry:repeat works in Mozilla and not IE...
I spent days trying to figure it out and the minute I post it
here the solution comes to me!





The problem was that the XML file was being generated by a
PHP script which was not outputting the appropriate headers.





You can use:

header('Content-Type: text/xml');



Or use this other one if your charset is NOT US-ASCII:

header('Content-Type: application/xml');

No comments:

Post a Comment