I am in the process of building an image gallery from an xml file. Here is the xml I'm working with:
<?xmlversion="1.0"encoding="utf-8"?>
<sections>
<section id="section-1">
<photo imageurl="images/gallery-images/1.jpg">
<title>Fusce dapibus, tellus ac cursus commodo</title>
<description type="wide">Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Maecenas sed diam eget risus varius blandit sit amet non magna.</description>
</photo>
</section>
<section id="section-2">
And the jquery I am using to get the contents of that file:
$.get('images/gallery-images/gallery-images.xml', function(parseXML){
$(parseXML).find('section').each(function(){
var $section = $(this);
var sectID = $section.attr('id');
var photo = $section.find('photo');
var imageurl = photo.attr('imageurl');
var title = photo.find('title').text();
var description = photo.find('description').text();
var kind = photo.find('description').attr('type');
var html = '<div class="gallery-section" id="' + sectID + '" >';
html += '<div class="photo">';
html += '<img src="' + imageurl +'" class="gallery-photo" />';
html += '<div class="photo-info ' + kind + '"><h1>' + title + '</h1>';
html += '<p>' + description + '</p></div>';
html += '</div></div>';
$('#photo-viewer-inner').append($(html));
$('#loading').delay(600).fadeOut(600);
});
});
So, what I need to do is to create sections for each "block of photos", then generate the images with their titles and descriptions inside of individual div's. This feels pretty basic to me, but this is my first foray into xml, so I am a bit in the dark. Please let me know if I need to provide more information. Thank you all!