21277 Posts in 5728 Topics by 2599 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 994 Views |
-
Weird behavior when using <?xml version="1.0"?>

21 February 2010 at 4:16am Last edited: 21 February 2010 4:18am
Hi,
I'm trying to use a gallery called galleriffic (http://www.twospy.com/galleriffic/), but for some reason, when using <?xml version="1.0"?> in my silverstripe document, the gallery isn't displayed. If I take out the <?xml version="1.0"?> it works fine. This is in a document called ArticlePage.ss. This only happens in silverstripe, if I copy paste the code that silverstripe produces and run it as a regular html document (and add the <?xml version again), it runs fine. This is my code, which is an exact copy paste from the galleriffic examples:<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en" >
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
<title>Galleriffic | Minimal implementation</title>
<link rel="stylesheet" href="http://www.twospy.com/galleriffic/css/basaic.css" type="text/css" />
<link rel="stylesheet" href="http://www.twospy.com/galleriffic/css/gallaeriffic-1.css" type="text/css" />
<script type="text/javascript" src="http://www.twospy.com/galleriffic/js/jquery-1.3.2.js"></script>
<script type="text/javascript" src="http://www.twospy.com/galleriffic/js/jquery.galleriffic.js"></script>
</head>
<body>
<div id="page">
<div id="container">
<h1><a href="index.html">Galleriffic</a></h1>
<h2>Minimal implementation</h2><!-- Start Minimal Gallery Html Containers -->
<div id="gallery" class="content">
<div id="controls" class="controls"></div>
<div class="slideshow-container">
<div id="loading" class="loader"></div>
<div id="slideshow" class="slideshow"></div>
</div>
</div>
<div id="thumbs" class="navigation">
<ul class="thumbs noscript">
<li>
<a class="thumb" href="http://farm4.static.flickr.com/3261/2538183196_8baf9a8015.jpg" title="Title #0">Title #0</a>
</li><li>
<a class="thumb" href="http://farm3.static.flickr.com/2404/2538171134_2f77bc00d9.jpg" title="Title #1">Title #1</a>
</li><li>
<a class="thumb" href="http://farm3.static.flickr.com/2093/2538168854_f75e408156.jpg" title="Title #2">Title #2</a>
</li><li>
<a class="thumb" href="http://farm4.static.flickr.com/3153/2538167690_c812461b7b.jpg" title="Title #3">Title #3</a>
</li><li>
<a class="thumb" href="http://farm4.static.flickr.com/3150/2538167224_0a6075dd18.jpg" title="Title #4">Title #4</a>
</li><li>
<a class="thumb" href="http://farm4.static.flickr.com/3204/2537348699_bfd38bd9fd.jpg" title="Title #5">Title #5</a>
</li><li>
<a class="thumb" href="http://farm4.static.flickr.com/3124/2538164582_b9d18f9d1b.jpg" title="Title #6">Title #6</a>
</li><li>
<a class="thumb" href="http://farm4.static.flickr.com/3205/2538164270_4369bbdd23.jpg" title="Title #7">Title #7</a>
</li><li>
<a class="thumb" href="http://farm4.static.flickr.com/3211/2538163540_c2026243d2.jpg" title="Title #8">Title #8</a>
</li><li>
<a class="thumb" href="http://farm3.static.flickr.com/2315/2537343449_f933be8036.jpg" title="Title #9">Title #9</a>
</li><li>
<a class="thumb" href="http://farm3.static.flickr.com/2167/2082738157_436d1eb280.jpg" title="Title #10">Title #10</a>
</li><li>
<a class="thumb" href="http://farm3.static.flickr.com/2342/2083508720_fa906f685e.jpg" title="Title #11">Title #11</a>
</li><li>
<a class="thumb" href="http://farm3.static.flickr.com/2132/2082721339_4b06f6abba.jpg" title="Title #12">Title #12</a>
</li><li>
<a class="thumb" href="http://farm3.static.flickr.com/2139/2083503622_5b17f16a60.jpg" title="Title #13">Title #13</a>
</li><li>
<a class="thumb" href="http://farm3.static.flickr.com/2041/2083498578_114e117aab.jpg" title="Title #14">Title #14</a>
</li><li>
<a class="thumb" href="http://farm3.static.flickr.com/2149/2082705341_afcdda0663.jpg" title="Title #15">Title #15</a>
</li><li>
<a class="thumb" href="http://farm3.static.flickr.com/2014/2083478274_26775114dc.jpg" title="Title #16">Title #16</a>
</li><li>
<a class="thumb" href="http://farm3.static.flickr.com/2194/2083464534_122e849241.jpg" title="Title #17">Title #17</a>
</li><li>
<a class="thumb" href="http://farm4.static.flickr.com/3127/2538173236_b704e7622e.jpg" title="Title #18">Title #18</a>
</li><li>
<a class="thumb" href="http://farm3.static.flickr.com/2375/2538172432_3343a47341.jpg" title="Title #19">Title #19</a>
</li><li>
<a class="thumb" href="http://farm3.static.flickr.com/2353/2083476642_d00372b96f.jpg" title="Title #20">Title #20</a>
</li><li>
<a class="thumb" href="http://farm3.static.flickr.com/2201/1502907190_7b4a2a0e34.jpg" title="Title #21">Title #21</a>
</li><li>
<a class="thumb" href="http://farm2.static.flickr.com/1116/1380178473_fc640e097a.jpg" title="Title #22">Title #22</a>
</li><li>
<a class="thumb" href="http://farm2.static.flickr.com/1260/930424599_e75865c0d6.jpg" title="Title #23">Title #23</a>
</li>
</ul>
</div>
<!-- End Minimal Gallery Html Containers -->
<div style="clear: both;"></div>
</div>
</div>
<div id="footer">© 2009 Trent Foley</div>
<script type="text/javascript">
// We only want these styles applied when javascript is enabled
$('div.navigation').css({'width' : '300px', 'float' : 'left'});
$('div.content').css('display', 'block');$(document).ready(function() {
// Initialize Minimal Galleriffic Gallery
$('#thumbs').galleriffic({
imageContainerSel: '#slideshow',
controlsContainerSel: '#controls'
});
});
</script>
</body>
</html>
Anybody have any clue as to what could be going on? -
Re: Weird behavior when using <?xml version="1.0"?>

21 February 2010 at 5:07am Last edited: 21 February 2010 5:08am
Some browsers are very picky when you have a XML header like you described. I suggest you remove it, it doesn't have to be there. If you want to keep it nevertheless, pay attention to the following things:
Always escape Varchar fields using $FieldName.XML, when in attributes using $FieldName.ATT
Example:<a href="$Link" title="$Title.ATT" >$Title.XML</a>
Always wrap JavaScript in a <![CDATA[ block.
Example:<script type="text/javascript">
/* <![CDATA[ */
alert('Hi');
/* ]]> */
</script>The comments /* */ are required, because otherwise IE 6 won't execute the JS code.
Don't use document.write in your JavaScript. document.write isn't allowed in XML documents, which breaks a lot of copy-paste scripts you find on the net (like google analytics)
-
Re: Weird behavior when using <?xml version="1.0"?>

21 February 2010 at 5:15am
That didn't seem to be it.
I removed it (it was just there because I was following the silverstripe tutorial), but still, I don't understand why this only happens with the pages silverstripe generates. -
Re: Weird behavior when using <?xml version="1.0"?>

21 February 2010 at 6:54am
Did you save the generated content of SilverStripe into a HTML File and this file didn't cause the issue? That would be astonishing.
If you got a HTML file, and code generated by SilverStripe, why not run a diff and find the differences between the two? -
Re: Weird behavior when using <?xml version="1.0"?>

22 February 2010 at 10:15am
that's exactly what i did.
Except that I added the <?xml at the beginning, since that won't show up in the html that's generated.
If I did this, what would I run the diff against?
| 994 Views | ||
|
Page:
1
|
Go to Top |


