jotix Posted November 6, 2009 at 12:59 AM Report Share #294941 Posted November 6, 2009 at 12:59 AM Ando a tentar no meu blog, o Eurito, colocar um header aleatório. De forma que, quando alguém visitar o Eurito, seja exibido um header aleatório. Para isso, já tenho o script, que exibe aleatoriamente um header, quando a página é carregada: http://eurito.net/wp-content/themes/nap/imagem-header.php A página php do header, para exibir a imagem do header, tem uma secção, em que vai chamar uma função de style.css <div class="top"> Indo ao ficheiro style.css, a função top, tem a seguinte descrição: .top { height:223px; margin-top:0px; background:url(images/header.jpg); background-repeat:no-repeat; Mas ao mudar essa parte para: .top { height:223px; margin-top:0px; background:url(http://eurito.net/wp-content/themes/nap/imagem-header.php); background-repeat:no-repeat; Não funciona! O que está errado? ? Link to comment Share on other sites More sharing options...
yoda Posted November 6, 2009 at 12:01 PM Report Share #294961 Posted November 6, 2009 at 12:01 PM Boas, Faz o seguinte no CSS : .top { height:223px; margin-top:0px; background-position: top left; background-repeat:no-repeat; } E no php : <div class="top" style="background-image:url(http://eurito.net/wp-content/themes/nap/imagem-header.php);"></div> Se não funcionar, em vez de usar uma div usa a tag img before you post, what have you tried? - http://filipematias.info sense, purpose, direction Link to comment Share on other sites More sharing options...
jwv Posted November 6, 2009 at 12:07 PM Report Share #294963 Posted November 6, 2009 at 12:07 PM Não funciona porque o que está devolver é uma tag img em vez da url <img src="http://i700.photobucket.com/albums/ww5/eurito/top3-1.jpg" border="0"> ; Tens de devolver apenas o url http://i700.photobucket.com/albums/ww5/eurito/top3-1.jpg Link to comment Share on other sites More sharing options...
NCS_One Posted November 6, 2009 at 01:02 PM Report Share #294966 Posted November 6, 2009 at 01:02 PM Boas. Provavelmente não funciona porque tens "imagem-header.php", não devia ser png, ou gif, ou jpeg, etc ? Se a vida te voltar as costas aproveita e apalpa-lhe o cu. Link to comment Share on other sites More sharing options...
scorch Posted November 6, 2009 at 02:20 PM Report Share #294972 Posted November 6, 2009 at 02:20 PM Boas. Provavelmente não funciona porque tens "imagem-header.php", não devia ser png, ou gif, ou jpeg, etc ? Não, porque a imagem é escolhida aleatoriamente pelo ficheiro imagem-header.php 😛 EDIT: jotix, o ficheiro PHP faz imprime as tags <img> ou uma imagem? PS: Não respondo a perguntas por mensagem que podem ser respondidas no fórum. Link to comment Share on other sites More sharing options...
jotix Posted November 6, 2009 at 08:00 PM Author Report Share #294999 Posted November 6, 2009 at 08:00 PM Antes de mais obrigado a todos pelas respostas 😛 Então, o codigo do ficheiro php, que mostra aleatoriamente as imagens é: <?php // generates some random content // start an array with some text strings... $blah[] = ' <img src="http://i700.photobucket.com/albums/ww5/eurito/top3-1.jpg" border="0"> '; $blah[] = ' <img src="http://i700.photobucket.com/albums/ww5/eurito/top2.jpg" border="0"> '; $blah[] = ' <img src="http://i700.photobucket.com/albums/ww5/eurito/top.jpg" border="0"> '; // seed php random number generator // http://www.php.net/srand srand ((float) microtime() * 10000000); // print a random $blah // http://www.php.net/array_rand print $blah[array_rand($blah)]; ?>; Link to comment Share on other sites More sharing options...
scorch Posted November 6, 2009 at 11:14 PM Report Share #295012 Posted November 6, 2009 at 11:14 PM Aí está o teu problema. Tens de exportar como imagens. 😛 http://www.php.net/manual/pt_BR/book.image.php PS: Não respondo a perguntas por mensagem que podem ser respondidas no fórum. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now