Bonjour à toutes et à tous.
Je suis newbie en php (je viens de java).

Pouvez vous me dire pourquoi mon programme en php ne fonctionne pas, merci.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
class Article {
 
	private $image,$nom,$montant,$href;
	public function __construct($href,$image,$nom,$montant) {
		this->href=$href;
		this->image=$image;
		this->montant=$montant;
		this->nom=$nom;
	}
 
	public function afficherArticle() {
	echo "<div class=\"homecat-box\" style=\"background:transparent url(images//bg-homecat-box.png) no-repeat scroll 0 0;
clear:both;
height:201px;
margin-bottom:20px;
overflow:hidden;
padding:0 0 5px 10px;\">"
	+"<dl>"
	+"<dt>"
	+"<a href=\""+$href+"\">"
	+"<img src=\""+$image+"\"//>"
	+"<//a>"
	+"</dt>"
	+"<dd>"
	+"<strong>"+$nom+"</strong>"
	+"</dd>"
	+"<dt class=\"name\"/>"
	+"<a href=\""+$href+"\"">"+$nom+"<//a>"
	+"<//dt>"
	+"<dd class=\"amount\">"+$montant+"<//dd>"
	+"<//dl>"
	+"<//div>";}
}?>
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
<html>
<head>
  <title> </title>
 </head>
 <body>
 <?php $obj = new Article("","/images/canon.jpg","Canon","399");
$obj.afficherArticle();
?>
</body>
</html>