Importer du texte dans des pages html

Résolu
Gizmil Messages postés 706 Date d'inscription   Statut Membre Dernière intervention   -  
Gizmil Messages postés 706 Date d'inscription   Statut Membre Dernière intervention   -
Salut à tous,

Je ne m'y connais pas en php mais j'ai besoin de ce langage pour importer du texte dans mes pages web et pouvoir le modifier facilement.

Voici comment ça se présente. Pour l'html, j'ai les pages suivantes:

work_01.html
work_02.html
work_03.html
work_04.html
...

Ces pages sont toutes constituées du code suivant:

<html>
<head>
<title>interface_works</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" media="screen" type="text/css" title="Design des pages de travaux" href="design_works_pages.css"/>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table height="40"><tr><td></td></tr></table>
<table id="table_description" width="800" border="0" cellpadding="0" cellspacing="0" align="center" valign="top">
<tr>
<td width="800" height="10" colspan="5" bgcolor="#000000"></td>
</tr>
<tr>
<td width="56" rowspan="4" bgcolor="#000000"></td>
<td class="hooksTop" colspan="3"></td>
<td width="56" rowspan="4" bgcolor="#000000"></td>
</tr>
<tr>
<td class="hooksColor"></td>
<!-- text description -->
<td class="textWork1" width="684" height="92" bgcolor="#000000" align="center">mon texte</td>
<!-- End text description -->
<td class="hooksColor"></td>
</tr>
<tr>
<td class="hooksBottom" colspan="3"></td>
</tr>
</table>
<table id="table_work" width="800" border="0" cellpadding="0" cellspacing="0" align="center" valign="top">
<tr><td class="spaceTextWork"></td></tr>
<tr>
<!-- work picture -->
<td class="work1" width="688" colspan="3" bgcolor="#000000"></td>
<!-- End work picture -->
</tr>
</table>
<table id="table_navigation" width="800" border="0" cellpadding="0" cellspacing="0" align="center" valign="top">
<tr><td></td></tr>
</table>
</body>
</html>

J'aimerais, au niveau de cette cellule:

<td class="textWork1" width="684" height="92" bgcolor="#000000" align="center">mon texte</td>

... pouvoir importer du texte depuis un fichier txt. Cela dit, j'aimerais n'avoir qu'un seul fichier txt et qu'il contienne tous les textes de chacunes de mes pages.

Comment est-ce réalisable? Vu que je ne m'y connais pas en PHP, si vous saviez m'expliquer ça de manière didactique...

Merci d'avance pour votre aide! ;)
A voir également:

5 réponses

Utilisateur anonyme
 
bonjour tu utilise des variable et tu inclu le fichier qui contient ton texte avec l'association aux varaible

exemple :
<?php include('text.php'); ?>

[...]

<td class="textWork1" width="684" height="92" bgcolor="#000000" align="center"><?php echo $texte1 ; ?></td> 


le fichier text.php :
<?php
$texte1 = "mon texte" ;
$texte2 = "un autre texte" ;
?>

etc
1
Gizmil Messages postés 706 Date d'inscription   Statut Membre Dernière intervention   65
 
Ok, impeccable! Merci Lapinkiller! (-;
0
Gizmil Messages postés 706 Date d'inscription   Statut Membre Dernière intervention   65
 
Ca marche pas... ):

<html>
<head>
<title>interface_works</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" media="screen" type="text/css" title="Design des pages de travaux" href="design_works_pages.css"/>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table height="40"><tr><td></td></tr></table>
<table id="table_description" width="800" border="0" cellpadding="0" cellspacing="0" align="center" valign="top">
<tr>
<td width="800" height="10" colspan="5" bgcolor="#000000"></td>
</tr>
<tr>
<td width="56" rowspan="4" bgcolor="#000000"></td>
<td class="hooksTop" colspan="3"></td>
<td width="56" rowspan="4" bgcolor="#000000"></td>
</tr>
<tr>
<td class="hooksColor"></td>
<!-- text description -->
<?php include ('works_text.php'); ?>
<td class="textWork" width="684" height="92" bgcolor="#000000" align="center"><?php echo $texte1 ; ?></td>
<!-- End text description -->
<td class="hooksColor"></td>
</tr>
<tr>
<td class="hooksBottom" colspan="3"></td>
</tr>
</table>
<table id="table_work" width="800" border="0" cellpadding="0" cellspacing="0" align="center" valign="top">
<tr><td class="spaceTextWork"></td></tr>
<tr>
<!-- work picture -->
<td class="work1" width="688" colspan="3" bgcolor="#000000"></td>
<!-- End work picture -->
</tr>
</table>
<table id="table_navigation" width="800" border="0" cellpadding="0" cellspacing="0" align="center" valign="top">
<tr><td></td></tr>
</table>
</body>
</html>
0
Utilisateur anonyme
 
pour l'extension de ta page tu a mi ".php" ?
sinon ton serveur supporte le php ?
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
Gizmil Messages postés 706 Date d'inscription   Statut Membre Dernière intervention   65
 
Oui, j'ai bien renommé l'extension mais disons que là, je teste en local... c'est peut-être une mauvaise idée? XD
0