Italiano
Ho sviluppato per l’utente golinux di flatpress un plugin che permette di avere gli ultimi post di FP su pagine statiche in HTML.
Purtroppo proprio perché è richiesto che siano in HTML puro e semplice ho dovuto farlo in Javascript.
Ma veniamo all’uso.
Si carica nell’head un js così:
<script src="fp-root/?lastentriesjs" type="text/javascript"></script>
E lui creerà un array js chiamato fp_lastentries.
Ogni elemento dell’array ha un oggetto js che contiene title e url.
Quindi per farli vedere per esempio il codice è questo (tuttavia non testato):
<script type="text/javascript">
len=fp_lastentries.length;
document.write(len==0 ? '' : '<ul>');
for(i=0; i<len; i++) {
document.write('<li><a href="'+fp_lastentries[i].url+'">'+fp_lastentries[i].title+'</a></li>');
}
document.write(len==0 ? '' : '</ul>');
</script>
Di default mostra 10 post, se ne volete in numero diverso dovete specificarlo via URL, per esempio fp-root/?lastentriesjs=numero oppure fp-root/?lastentriesjs&count=numero.
Licenza: GNU GPLv2
Download: Tarball Gzippato
English
I’ve developed for golinux of Flatpress forum a plugin that allows to show FP last entries in HTML Static Pages.
The output is in Javascript.
You add in you head this:
<script src="fp-root/?lastentriesjs" type="text/javascript"></script>
Then the plugin creates a js array called fp_lastentries.
Each array item, has a javascript object that has two proprieties: title and url.
So, to show entries, you have to use a code similar to this (not tested yet):
<script type="text/javascript">
len=fp_lastentries.length;
document.write(len==0 ? '' : '<ul>');
for(i=0; i<len; i++) {
document.write('<li><a href="'+fp_lastentries[i].url+'">'+fp_lastentries[i].title+'</a></li>');
}
document.write(len==0 ? '' : '</ul>');
</script>
By default it shows 10 entries, but you can specify a different number by URL params, for example fp-root/?lastentriesjs=number or fp-root/?lastentriesjs&count=number.
License: GNU GPLv2
Download: Gzipped Tarball