Home › Forum › Plugin e temi di WP › Header con immagini a rotazione
-
AutorePost
-
-
7 Agosto 2006 alle 1:28 #1973RiccardoPartecipante
Il codice del mio file header.php che visulizza l’header è questo:
<?php
require(‘./wp-blog-header.php’);
?>
In pratica mi occorrerebbe fare in modo che l’eader cambiasse casualmente in base a 3 immagini…
Ho torvato questo codice ma è in java per una pagina html… come posso integrarlo?
<script language=”JavaScript1.2″>
var ie=document.all&&navigator.userAgent.indexOf(“Opera”)==-1
var dom=document.getElementById&&navigator.userAgent.indexOf(“Opera”)==-1
var iframeprops=’width=309 height=414 marginwidth=”0″ marginheight=”0″ hspace=”0″ vspace=”0″ frameborder=”no” scrolling=”no”‘
var randomcontent=new Array()
randomcontent[0]=”images/tinaindex.jpg”
randomcontent[1]=”images/tinaindex2.jpg”
randomcontent[2]=”images/tinaindex3.jpg”
randomcontent[3]=”images/tinaindex2.jpg”
randomcontent[4]=”images/tinaindex.jpg”
randomcontent[5]=”images/tinaindex3.jpg”
randomcontent[6]=”images/tinaindex.jpg”
randomcontent[7]=”images/tinaindex2.jpg”
randomcontent[8]=”images/tinaindex3.jpg”
//netscape
var arraynumb = randomcontent.length;
casual=Math.floor(Math.random()*arraynumb)
var ilayerand = randomcontent[casual];
if (ie||dom){
document.write(‘<iframe id=”dynstuff” src=”” ‘+iframeprops+’></iframe>’);
}
else{
document.write(‘<ilayer align=”center” name=”‘ + ilayerand + ‘” src=”‘ + ilayerand + ‘”></ilayer>’);
}
function random_iframe(){
if (ie||dom){
var iframeobj=document.getElementById? document.getElementById(“dynstuff”) : document.all.dynstuff
iframeobj.src=randomcontent[Math.floor(Math.random()*randomcontent.length)]
}
}
window.onload=random_iframe
</script>
Grazie 1000
-
7 Agosto 2006 alle 9:40 #39714rhazckalPartecipante
Scusa perchè non usi randomize?
E’ di facile utilizzo e basta una stringa nel Template da te scelto per farlo funzionare.
Ciao,
rhazckal
-
7 Agosto 2006 alle 10:58 #39717RiccardoPartecipante
Non so di cosa parli… potresti illuminarmi?
Grazie 1000
-
7 Agosto 2006 alle 13:05 #39719DoctorPartecipante
Riccardo, avevolo stesso problema anche io. devi creare un file che ho chiamato Rotator.php (se vuoi te lo mando) e utilizzarlo come se fosse un’immagine..nel senso che quando nel file header.php viene specificata l’immagine ta utilizzare nell’header, tu invece di dargli l’immagine esempio.jpg, gli dai il file rotator.php nel quale è specificata invece la cartella dove quel file va a recuperare le immagini che tu hai scelto..è molto semplice. Ti consiglio di dare un’occhiata qui, è il sito dal quale ho recuperato il file..
-
7 Agosto 2006 alle 20:53 #39727RiccardoPartecipante
Mi potresti mandare il file a info@formicabianca.it ?
Grazie 1000
-
30 Marzo 2008 alle 19:31 #51923nocs90Partecipante
Salve a tutti , scusa DOCTOR come è che si scrive il file .php ?
-
30 Marzo 2008 alle 19:59 #51928gidibaoPartecipante
Ciao Riccardo,
guarda se questo mio articolo (Random header images per WordPress) potrebbe esserti utile…
EDIT
scusa, non avevo letto che il 3D fosse vecchio di un anno… °.°
-
-
AutorePost
- Devi essere connesso per rispondere a questo topic.