Hey j’ai un problème en Web Dev, que dois-je faire ?
Faire une recherche
Poster ici pour un problème sans avoir cherché sur un moteur de recherche est fortement déconseillé, comme partout.
Lire les références des langages :[ul]
[li]HTML[/li][li]CSS[/li][li]documentation:css (merci the_webrunner)[/li][li]PHP[/li][li]MySQL[/li][li]JavaScript[/li][li]créer un texte pour tester un site[/li][/ul]Lire les guides :[ul]
[li]Openweb.eu.org[/li][li]Pompage > Techniques et astuces pratiques pour une mise en page CSS[/li][li]JavaScript[/li][/ul]Valider son code[ul]
[li]la validateur HTML du W3C : ça corrige pas forçément les erreurs, mais ça permet de corriger les balises mal fermées, etc.[/li][li]le validateur CSS du W3C : comme pour le HTML, ça résoud pas le problème, mais ça peut aider[/li][li]le validateur Atom ou RSS du W3C : idem[/li][/ul]Les outils[ul]
[li]Typetester : pour tester les polices (merci The_Spacecowboy)[/li][li]Browsershots : pour tester un site avec différents navigateurs (merci Knep)[/li][/ul]Comment poster son code :
N’oubliez pas d’enlever les espaces entre les crochets et de fermer les balises, comme ceci : [mabalise]mon texte[/mabalise]
Si c’est du HTML : la balise [ html ] : [html]
cafzone.net powaa <script language="JavaScript" type="text/javascript">zog
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nullam vestibulum interdum augue. Quisque luctus odio nec enim. Nulla facilisi. Integer nulla lorem, mattis et, sollicitudin vitae, facilisis sit amet, est. Aliquam tristique. Proin suscipit tellus quis metus. Nulla dolor turpis, tempus vel, vestibulum quis, pharetra non, arcu. Morbi facilisis sem vitae erat. In malesuada odio vel magna. Cras eget justo. Nunc pellentesque. [/html]Les exemples suivants viennent de php.net.
Pour le code, la balise [ code ] :[codebox]<?php
$left = 0;
$top = 0;
$x_size = 400;
$y_size = 400;
$char_width = 8;
$char_height = 11;
$x_start = $x_left + 100;
$y_start = $top + $char_height * 1.5;
$x_end = $x_start + $x_size;
$y_end = $y_start + $y_size;
$right = $x_start + $x_size + 40;
$bottom = $y_start + $y_size + $char_height * 1.5;
$graph_n = 100;
for($i = 0; $i < $graph_n; $i++ )
{
$graph_x[$i] = $i;
$graph_y[$i] = $i * $i;
}
$min_x = 9e99;
$min_y = 9e99;
$max_x = -9e99;
$max_y = -9e99;
$avg_y = 0.0;
for($i = 0; $i < $graph_n; $i++ )
{
if( $graph_x[$i] < $min_x )
$min_x = $graph_x[i];
if( $graph_x[$i] > $max_x )
$max_x = $graph_x[$i];
if( $graph_y[$i] < $min_y )
$min_y = $graph_y[$i];
if( $graph_y[$i] > $max_y )
$max_y = $graph_y[$i];
$avg_y += $graph_y[$i];
}
$avg_y = $avg_y / $graph_n;
$min_x = 0;
$min_y = 0;
$max_x += $max_x * 0.05;
$max_y += $max_y * 0.05;
$image = ImageCreate($right - $left, $bottom - $top);
$background_color = imagecolorallocate($image, 255, 255, 255);
$text_color = imagecolorallocate($image, 233, 14, 91);
$grey = ImageColorAllocate($image, 204, 204, 204);
$white = imagecolorallocate($image, 255, 255, 255);
$black = imagecolorallocate($image, 0, 0, 0);
$red = imagecolorallocate($image, 255, 0, 0);
imagerectangle($image, $left, $top, $right - 1, $bottom - 1, $black );
imagerectangle($image, $x_start, $y_start, $x_end, $y_end, $grey );
for($i = 0; $i < $graph_n; $i++ )
{
$pt_x = $x_start + ($x_end-$x_start)($graph_x[$i]-$min_x)/($max_x-$min_x);
$pt_y = $y_end - ($y_end - $y_start)($graph_y[$i]-$min_y)/($max_y-$min_y);
// imagesetpixel( $image, $pt_x, $pt_y, $black );
imagechar($image, 2, $pt_x - 3, $pt_y - 10, ‘.’, $black);
}
$string = sprintf("%2.5f", $max_y);
imagestring($image, 4, $x_start - strlen($string) * $char_width, $y_start - $char_width, $string, $black);
$string = sprintf("%2.5f", $min_y);
imagestring($image, 4, $x_start - strlen($string) * $char_width, $y_end - $char_height, $string, $black);
$string = sprintf("%2.5f", $min_x);
imagestring($image, 4, $x_start - (strlen($string) * $char_width)/2, $y_end, $string, $black);
$string = sprintf("%2.5f", $max_x);
imagestring($image, 4, $x_end - (strlen($string) * $char_width) / 2, $y_end, $string, $black);
$x_title = ‘x axis’;
$y_title = ‘y axis’;
imagestring($image, 4, $x_start + ($x_end - $x_start) / 2 - strlen($x_title) * $char_width / 2, $y_end, $x_title, $black);
imagestring($image, 4, $char_width, ($y_end - $y_start) / 2, $y_title, $black);
header(‘Content-type: image/png’);
$filename = sprintf("%d.png", time());
ImagePNG($image,$filename);
ImageDestroy($image);
printf(" ", $filename);
?>
[/codebox]
N’hésitez pas à poster pour ajouter des infos, remarques, etc.