Graham
TECRIDIBLE This will create a marquee of your latest blog posts
I am using xhr to avoid issues with blog block id
First rename
xtblog.twig to
blog.twig and create a new
xtblog.twig with this
{% if data.translations.t_no_entries_found == 'marquee' %}
{% for entry in data.entries %}<a href="{{data.translations.t_post}}/__xtblog_entry{{entry.url|split('/__xtblog_entry')[1]}}"> ※ {{ entry.title }}</a>{% endfor %}
{% else %}
{% include ('blog.twig') %}
{%endif%}
Copy code Add this javascript to your page below the
<marquee> tag
<script>
// marquee
function marquee(){
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function(){
if (this.readyState == 4 && this.status == 200){
var content=this.responseText.split('<!--data-->')[1];
document.getElementById('marquee').innerHTML = content;
}
}
xhttp.open('GET', '/marquee_data?path=<xt:url type="path" />', true);
xhttp.send();
}
marquee()
</script>
Copy code Create a
blank text file called
marquee_data and add this code
<meta name="robots" content="noindex" />
<script>
/*
<!--data--><xt:blog entries_per_page="10" t_no_entries_found="marquee" t_post="{_$path|}" /><!--data-->
*/
</script>
Copy code add
id="marquee" to your marquee tag