Précédent   Forum des professionnels en informatique > Webmasters - Développement Web > Général Conception Web
Général Conception Web Forum d'entraide sur les choix technologiques. Avant de poster : Cours Dév. Web, FAQs Dév. Web, Sources Dév. Web
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 17/08/2011, 15h19   #1
Membre habitué
 
Inscription : juin 2004
Messages : 614
Détails du profil
Informations forums :
Inscription : juin 2004
Messages : 614
Points : 136
Points : 136
Par défaut Mise en forme d'un dossier "brut"

Bonjour,
Quand je vais dans un dossier de mon espace provider qui ne contient pas de choses spécifique j'obtiens ceci :

Comme on le voit sur l'illustration les noms de fichiers sont coupés après 20 caractères ce qui est assez ennuieux.
Quelqu'un sait il comment faire pour doubler (au moins) le nombre de caractères de manière à ce que le nom du fichier soit lisible et compréhensible.
Merci.
puce_84 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 19/08/2011, 12h17   #2
Membre habitué
 
Inscription : juin 2004
Messages : 614
Détails du profil
Informations forums :
Inscription : juin 2004
Messages : 614
Points : 136
Points : 136
Vu que tout le monde s'en fou j'ai fini par trouver la solution (ou plutôt c'est un pote qui l'a trouvée). Je la met ici on ne sait jamais ça peu pet être servir à quelqu'un d'autre ...

Il suffit de copier le code suivant dans le bloc note, de sauver et de renommer en index.php. Esnuite on met ce fichier "index.php" dans chaque dossier Internet qui doit être mis en forme.

Code :
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>TITRE DE LA PAGE</title>
<style>
body {
	color: #000000;
	background-color: #FFFFFF;
	margin:10px ;
	padding:0px 0px 0px 0px;
	font-size: 76%;
	font-family: verdana, arial, helvetica, sans-serif;
}

h1, h2, h3, h4, h5, h6 {
	color: #000000;
	margin:0px 0px 15px 0px;
	padding:0px 0px 0px 0px;
	font-family: Verdana, arial, helvetica, sans-serif;
}

h1 {font-size: 1.8em;}
h2 {font-size: 1.6em;}
p {     font-size: 1em; }
/* for i.e */
table {font-size: 1em;}
table, tr, td, th {margin:0px 0px 0px 0px;}
.directory, .directory a:link {background-color: #888888; color: #ffffff; }
th {background-color: #336699; color: #ffffff; }
th a:link {color: #ffffff; text-decoration: none; }
th a:visited {color: #ffffff; text-decoration: none; }
th a:hover {background-color: #336699; color: #000000;}

a { font-size: 1em; text-decoration:none; }
a:link {color: #0000cc;}
a:visited {color: #0000cc;}
a:hover {background-color: #336699; color: #FFFFFF;}

dt { font-weight: bold; }
code {font-size: 120%;}
pre {font-size: 120%;}
</style>
</head>

<body>
<?php

function format_bytes($bytes) {
   if ($bytes < 1024) return $bytes.' B';
   elseif ($bytes < 1048576) return round($bytes / 1024, 2).' KB';
   elseif ($bytes < 1073741824) return round($bytes / 1048576, 2).' MB';
   elseif ($bytes < 1099511627776) return round($bytes / 1073741824, 2).' GB';
   else return round($bytes / 1099511627776, 2).' TB';
}


// open this directory 
$myDirectory = opendir(".");

// get each entry
while($entryName = readdir($myDirectory)) {
	$dirArray[] = $entryName;
}

// close directory
closedir($myDirectory);

//	count elements in array
$indexCount	= count($dirArray);
Print ("$indexCount fichiers<br>\n");

// sort 'em
sort($dirArray);

// print 'em
print("<TABLE border=1 cellpadding=5 cellspacing=0 class=whitelinks>\n");
print("<TR><TH>Nom du fichier</TH><th>Extension</th><th>Taille</th></TR>\n");
// loop through the array of files and print them all
$hidden_extensions = array(".html", ".htm", ".php", ".css");
for($index=0; $index < $indexCount; $index++) {
	$filename=$dirArray[$index];
	$extension=strtolower(substr ($filename, strrpos ($filename, '.')));
	$filesize = 	filesize($dirArray[$index]);
	$filetype = filetype($dirArray[$index]);
	
	if (! in_array($extension,$hidden_extensions)  &&  substr("$filename", 0, 1) != "." ) { //cacher les fichiers système && $filetype !="dir"
	if ($filetype =="dir")	{
		print("<TR class='directory'><TD ><a href=\"$filename\">".strtoupper($filename)."</a></td>");
		print("<td>");
		//print();
		print ("REPERTOIRE");
		print("</td>");
		print("<td>");
		print("&nbsp;");
		print("</td>");
		print("</TR>\n");
		}
	else{
		print("<TR><TD><a target='_blank' href=\"$filename\">$filename</a></td>");
		print("<td>");
		//print();
		print ($extension);
		print("</td>");
		print("<td>");
		print(format_bytes($filesize));
		print("</td>");
		print("</TR>\n");
		}
	}
}
print("</TABLE>\n");
?>
</body>
</html>
puce_84 est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité Cette discussion est résolue.
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 06h58.


 
 
 
 
Partenaires

Hébergement Web