Estoy tratando de migrar un site estatico a wordpress y este utiliza el plugin "jcarousel" de jquery.
He notado que la fuente del texto que va en el carrusel esta en un archivo xml. Como es de saber wordpress utiliza PHP.
Me pregunto:
1. Puedo olvidarme de usar XML y usar solo PHP?
2. Cual es la ventaja de XML vs PHP?
p.d.
Intente insertar el codigo en formato de codigo, pero no se o no se puede.
---------------------------------------------
<script type="text/javascript">
function mycarousel_initCallback(carousel, state)
{
// Lock until all items are loaded. That prevents jCarousel from
// setup correctly and we have to do that in the ajax callback
// function with carousel.setup().
// We're doing that because we don't know the exact height of each
// items until they are added to the list.
carousel.lock();
jQuery.get(
'xml/news_text.xml',
{},
function(xml) {
mycarousel_itemAddCallback(carousel, xml);
},
'xml'
);
};
function mycarousel_itemAddCallback(carousel, xml)
{
var $items = jQuery('entry', xml);
$items.each(function(i) {
carousel.add(i + 1, mycarousel_getItemHTML(this));
});
carousel.size($items.size());
// Unlock and setup.
carousel.unlock();
carousel.setup();
};
/**
* Item html creation helper.
*/
function mycarousel_getItemHTML(item)
{
return '<dt><time class="icon"><em>' + $('day', item).text() + '</em><strong>' + $('month', item).text() + '</strong><span>' + $('date', item).text() + '</span></time></dt><dd><p class="title">' + $('title', item).text() + '</p><p> ' + $('description', item).text() + '</p></dd>';
};
jQuery(document).ready(function() {
/**
* We show a simple loading indicator
* using the jQuery ajax events
*/
jQuery().ajaxStart(function() {
jQuery(".jcarousel-clip-vertical").addClass('loading');
});
jQuery().ajaxStop(function() {
jQuery(".jcarousel-clip-vertical").removeClass('loading');
});
jQuery('#mycarousel').jcarousel({
vertical: true,
scroll: 1,
size: 0,
initCallback: mycarousel_initCallback
});
});
</script>
MOD EDIT: Agregado de etiquetas GeSHi