Mettre en valeur un control par le biais d'une variable

Répondre


Cette question est un moyen d’empêcher des soumissions automatisées de formulaires par des robots.
Smileys
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen: =D> #-o =P~ :^o :non: :priere: 8-|
Voir plus de smileys
  Revue du sujet
 

  Étendre la vue Revue du sujet : Mettre en valeur un control par le biais d'une variable

par gesualda » 14 nov. 2005, 22:29

Merci cyrano,

Donc il faut que je mette par ligne la valeur de $corp_prof dans mon cas, si j'ai bien compris.
$corps_prof  = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">'."\r\n";
$corps_prof .= '<html>'."\r\n";
$corps_prof .= '<head>'."\r\n";
$corps_prof .= '<meta http-equiv="Content-Type" content="text/html;
et non pas
$corps_turek="
<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"\"http://www.w3.org/TR/html4/loose.dtd\">
<html>
<head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">
<title>Enregistrement d'un nouveau client chez EUROTRAD</title>
<style type=\"text/css\">
En fait j'avais vu faire sur un exemple je sais plus ou. Mais je reconnais que c'est bien plus lisible et facile à comprendre.

Une fois encore merci beaucoup de ton aide et explication

Gesualda :roll:

par Cyrano » 14 nov. 2005, 22:09

La premièr chose à faire, ce sont des concaténations propres: on ne mélange pas n'importe comment du HTML et du PHP. Suggestion, j'ai déplacé le test de contrôle en haut où il a plus sa place et défini une nouvelle variable :
<?php
/* Routine pour la visibilité du tel portable*/
$voir_port  = '- Tel portable<span>'. $tel_indic . '-' . $tel_port . '</span><br>'."\r\n";
$cache_port = '<span style="display:none;"></span>';
$port = empty($tel_port) ? $cache_port : $voir_port;

$corps_prof  = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">'."\r\n";
$corps_prof .= '<html>'."\r\n";
$corps_prof .= '<head>'."\r\n";
$corps_prof .= '<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">'."\r\n";
$corps_prof .= '<title>mon site </title>'."\r\n";
$corps_prof .= '<style type="text/css">'."\r\n";
$corps_prof .= '<!--'."\r\n";
$corps_prof .= 'body{'."\r\n";
$corps_prof .= '    margin:0;'."\r\n";
$corps_prof .= '    font-family: Georgia, "Times New Roman", Times, serif;'."\r\n";
$corps_prof .= '    font-size: 1em;'."\r\n";
$corps_prof .= '    }'."\r\n";
$corps_prof .= '#cont{'."\r\n";
$corps_prof .= '    width: 700px;'."\r\n";
$corps_prof .= '    margin-right: auto;'."\r\n";
$corps_prof .= '    margin-left: auto;'."\r\n";
$corps_prof .= '    padding-top: 1em;'."\r\n";
$corps_prof .= '}    '."\r\n";
$corps_prof .= '#cont h2{'."\r\n";
$corps_prof .= '    width: 100%;'."\r\n";
$corps_prof .= '    text-align: center;'."\r\n";
$corps_prof .= '    text-decoration: underline;'."\r\n";
$corps_prof .= '}'."\r\n";
$corps_prof .= '#cont p{'."\r\n";
$corps_prof .= '    width: 100%;'."\r\n";
$corps_prof .= '    text-align: justify;'."\r\n";
$corps_prof .= '}'."\r\n";
$corps_prof .= '#cont span{'."\r\n";
$corps_prof .= '    color: #0000CC;'."\r\n";
$corps_prof .= '}'."\r\n";
$corps_prof .= '-->'."\r\n";
$corps_prof .= '</style>'."\r\n";
$corps_prof .= '</head>'."\r\n";
$corps_prof .= '<body>'."\r\n";
$corps_prof .= '  <div id="cont">'."\r\n";
$corps_prof .= '    <h2>mon site, '. $email_13 .'</h2>'."\r\n";
$corps_prof .= '    <p>eurosite<span>&reg;</span><br>'."\r\n";
$corps_prof .= '    rue du bois<br>'."\r\n";
$corps_prof .= '    65000 machin</p>'."\r\n";
$corps_prof .= '    <p>Tel: &nbsp;0033 - Ø3 87 85 66 68<br>'."\r\n";
$corps_prof .= '    Fax: 0033 - Ø3 87 85 69 39<br>'."\r\n";
$corps_prof .= '    Email: [email protected]</p>'."\r\n";
$corps_prof .= '    <p>&nbsp;</p>'."\r\n";
$corps_prof .= '    <p>'. $mail_1  .' '. $titre .' <span>'. $nom .' '. $prenom .'</span></p>'."\r\n";
$corps_prof .= '    <p>'. $mail_2 .' '. $date_envoi .', '. $mail_3 .'<span>"'. $genre[0] .' '. $genre[1] .' '. $genre[2] .' '. $genre[3] .'"</span> '. $mail_4 .' <br>'."\r\n";
$corps_prof .= '    '. $mail_5 .' <span>'. $nb_ligne .'</span> '. $mail_6 .' <span>" '. $sens_a .'-'. $sens_b .' "</span>'. $mail_7 .' <span>'. $day .' '. $moi .' '. $annee .'</span>.</p>'."\r\n";
$corps_prof .= '    <p>'. $mail_8 .'<br>'."\r\n";
$corps_prof .= '    - '. $mail_9 .' <span>'. $tel_indic .' - '. $tel_fixe .'</span><br>'."\r\n";
$corps_prof .= '    '. $port .'- E-mail : <span>'. $email .'</span></p>'."\r\n";
$corps_prof .= '    <p>'. $mail_10 .'</p>'."\r\n";
$corps_prof .= '    <p>'. $mail_11 .'</p>'."\r\n";
$corps_prof .= '  </div>'."\r\n";
$corps_prof .= '</body>'."\r\n";
$corps_prof .= '</html>'."\r\n";
echo($corps_prof);
?>
Comme tu peux voir, j'ai créé une variable $port que j'ai mis à la place de ton test au milieu du code, déplacé le test en haut, et à l'arrivée, la valeur de la variable est de toutes façon définie au moment de t'en servir.

Mettre en valeur un control par le biais d'une variable

par gesualda » 14 nov. 2005, 21:32

Bonjour à tous,

J'aimerai savoir comment faire prendre en compte le control en gras dans cet envoi.
$corps_prof étant la variable qui contient le mail en htm.
/* Routine pour la visibilité du tel portable*/
$voir_port  = '- Tel portable<span>'. $tel_indic . '-' . $tel_port . '</span><br>';
$cache_port = '<span style="display:none;"></span>';

$corps_prof	= 
"
<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"\"http://www.w3.org/TR/html4/loose.dtd\">
<html>
<head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">
<title>mon site </title>
<style type=\"text/css\">
<!--
body{
	margin:0;
	font-family: Georgia, \"Times New Roman\", Times, serif;
	font-size: 1em;
	}
#cont{
	width: 700px;
	margin-right: auto;
	margin-left: auto;	
}	
#cont h2{
	width: 100%;
	text-align: center;
	text-decoration: underline;
}
#cont p{
	width: 100%;
	text-align: justify;
}
#cont span{
	color: #0000CC;
}
-->
</style>
</head>
<body>
<div id=\"cont\">
<br>
<h2>mon site, $email_13</h2>
<p>
eurosite<span>&reg;</span><br>
rue du bois<br>
65000 machin<br><br>
Tel: &nbsp;0033 - &Oslash;3 87 85 66 68<br>
Fax: 0033 - &Oslash;3 87 85 69 39<br>
Email: [email protected]
</p>

<p>&nbsp;</p>

<p>
$mail_1 $titre <span>$nom $prenom</span><br><br>
$mail_2 $date_envoi, $mail_3
 <span>\"$genre[0] $genre[1] $genre[2] $genre[3]\"</span> $mail_4 <br> 
$mail_5 <span>$nb_ligne</span> $mail_6 <span>\" $sens_a-$sens_b \"</span>
$mail_7 <span>$day $moi $annee</span>.
</p>
<p>
$mail_8<br>
- $mail_9 <span>$tel_indic - $tel_fixe</span><br>
[color=blue][b]if(empty($tel_port)){$tel_port ==  ''; $cache_port;}else{$voir_port;}[/b][/color]
- E-mail : <span>$email</span><br><br>
$mail_10 
</p>
<p>
$mail_11
</p>
</div>
</body>
</html>";
Merci de vos explications.