Jump to content

Nóticias em php


Tiago Tiago
 Share

Recommended Posts

Boas!

Estou a tentar fazer uma espécie de noticias que ira ser mais ou menos assim: tenho uma pagina que tem as noticias a passar em rodapé e depois em cima aparece uma imagem correspondente a essa noticia. Ate agora o que tenho é:

<table border="1" width="13%" height="209" style="border-width: 0px">
<tr>
	<td height="171" style="border-style: none; border-width: medium">
<marquee height="169"><?php include "texto.txt"; ?></marquee></td>
</tr>
</table>

este código esta a ir buscar o que esta escrito a um ficheiro .txt que é onde tenho as noticias mas não sei como ponho as imagens a aparecerem correspondentemente a noticia.

Se alguém poder dar uma dica agradecia.

Link to comment
Share on other sites

talvez o melhor fosse mesmo por por XML tipo:

<?xml version="1.0" encoding="utf-8"?>

<noticias>

<a>Noticia = "texta.txt" Img = "a.jpg"</a>
<b>Noticia = "textb.txt" Img = "a.jpg"</b>

</noticias>

não sei muito bem programar em XML  🙂

mas depois no php como faço correspondência a onde aparecer: Noticia e IMG?

Link to comment
Share on other sites

Tenta assim:

<?xml version="1.0" encoding="utf-8"?>

<noticias>
    <noticia>
        <text>O texto da notícia aqui!</text>
        <img>images/caminho_da_imagem.jpg</img>
    </noticia>

    <noticia>
        <text>O texto da notícia aqui!</text>
        <img>images/caminho_da_imagem.jpg</img>
    </noticia>
</noticias>

Para manipulares XML, podes usar isto.

PS: Não respondo a perguntas por mensagem que podem ser respondidas no fórum.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.