salut les copains,
Je me relance dans la création d'un site web d'actualité et j'ai un vieux système certes pas top mais qui ma toujours été très fonctionnel... alors oui je c'est... c pas du dynamique, mais franchement il est super pour mon utilisation.
Il m'avais été réalisé par un jeune dev a l'époque et bien entendu aujourd'hui il ne marche plus trop.

Je pense que le problème viens de ce fichier la... les actualité s'enregistre dans la base de donnée, mais il ne s'affiche plus sur le site j'ai beau essayer depuis 15 jours rien a faire cela ne marche pas. si vous pouvez m'aider.
J'ai 4 fichiers mais je pense que c'est celui ci qui merdouille.

Si jamais il vous faut les autres fichiers pas de soucis

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
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
<?php
 
require_once('db.lib.php');
 
function get_news_headers($num = 30, $date = NULL, $category = NULL, $offset = 0, $signe = false)
{
	get_db_link();
	$news = array(); 
	$wheres = null;
 
	                if($signe == false) $Signe = ' = ';
                else $Signe = ' != ';         
                if (!is_null($date))          $wheres .= ' AND `date` LIKE \'' . $date . '%\'';  
                if (!is_null($category)) {
                	if ( is_array($category) ) {
	                	$wheres .= ' AND `category` '. ( false === $signe ? 'IN' : 'NOT IN' ) . ' (\'' . implode('\', \'', $category) . '\')';
                	} else {
	                	$wheres .= ' AND `category` '.$Signe.' \'' . $category . '\''; // $Signe est = ou != suivant si true ou false (false est par defaut)  
                	}
                }	
 
	$sql =	'SELECT `id`, `title`, `bold`, `before_title`, `source`, `url`,`thumbnail`, `logo`, `date`, `description`, `category`, `categoryr`, `category2`, `author`, `produitx`, `tagg1`, `tagg2`, `tagg3`, `tagg4`, `images`, `compteur`' .
			' FROM `news_news`' .
			' WHERE' .
				' `date` <= NOW()' .
				' AND `date` > 0' .
				$wheres .
			' ORDER BY `date` DESC' .
			( $num > 0 ? ' LIMIT ' . $offset . ', ' . $num . ';' : '' );
	$result = mysql_query($sql);
 
	while ($row=mysql_fetch_assoc($result))	{
		$row['url'] = news_format_url($row['url']);
		$news[$row['id']] = $row;
	}
 
	return $news;
}
 
function get_news($news)
{
	get_db_link();
 
	$sql = 	'SELECT *' .
			' FROM `news_news`' .
			' WHERE `' . ( is_numeric($news) ? 'id' : 'url' ) . '` = \'' . $news . '\'' .
			' LIMIT 1;';
	$result = mysql_query($sql);
 
	if ( ! $row = mysql_fetch_assoc($result) )
	{
		return false;
	}
 
	$row['url'] = news_format_url($row['url']);
 
	return $row;
}
 
function news_format_url($page)
{
	return '/actualite/' . $page . '.html';
}
 
function news_get_url_page_name($url)
{
	return substr($url, 11, -5);
}
 
function news_print_get_url_page_name($url)
{
	return substr($url, 7, -5);
}
 
function delete_news($id)
{
	get_db_link();
 
	$sql = 'DELETE FROM `news_news` WHERE `id` = \'' . $id . '\' LIMIT 1;';
	$result = mysql_query($sql);
}
 
function quote_replace($string)
{
	return str_replace(array('"', '\''), array('\"', '\\\''), $string);
}
 
function get_formatted_news_headers($pattern, $num = 30, $date = NULL, $category = NULL)
{
	$news_formatted = '';
 
	preg_match_all('/##([^#]+)##/', $pattern, $matches);
 
	$news_headers = get_news_headers($num, $date, $category);
	foreach ( $news_headers as $id => $news_header )
	{
		$tmp_pattern = $pattern;
		foreach ( $matches[1] as $id => $match )
		{
			if ( 'date' === substr($match, 0, 4) )
			{
				list($match, $date_format) = explode('@', $match);
				$news_header['date'] = date($date_format, strtotime($news_header['date']));
			}
			else if ( 'title' === substr($match, 0, 5) )
			{
				list($match, $limit) = explode('@', $match);
 
				if ( $limit > 0 && strlen($news_header['title']) > $limit )
				{
					$news_header['title'] = substr($news_header['title'], 0, ($limit - 3)) . '...';
				}
			}
			else if ( 'color' == substr($match, 0, 5) ) {
				$news_header['color'] = getCouleur($i);
			}
 
			$tmp_pattern = str_replace($matches[0][$id], $news_header[$match], $tmp_pattern);
		}
		$news_formatted .= $tmp_pattern;
	}
 
	return $news_formatted;
}
 
 
//================================= Ajouté
function get_news_headers2($num = 30, $date = NULL, $category2 = NULL, $offset = 0)
{
	get_db_link();
	$news = array();
 
	$wheres = '';
	if ( ! is_null($date) )
	{
		$wheres .= ' AND `date` LIKE \'' . $date . '%\'';
	}
	if ( ! is_null($category2) )
	{
		$wheres .= ' AND `category2` = \'' . $category2 . '\'';
	}
 
	$sql = 	'SELECT `id`, `title`, `bold`, `before_title`, `url`,`thumbnail`, `logo`, `date`, `description`, `category2`, `categoryr`, `category2`, `author`, `produitx`, `tagg1`, `tagg2`, `tagg3`, `tagg4`, `compteur`' .
			' FROM `news_news`' .
			' WHERE' .
				' `date` <= NOW()' .
				' AND `date` > 0' .
				$wheres .
			' ORDER BY `date` DESC' .
			( $num > 0 ? ' LIMIT ' . $offset . ', ' . $num . ';' : '' );
	$result = mysql_query($sql);
 
	while ( $row = mysql_fetch_assoc($result) )
	{
		$row['url'] = news_format_url($row['url']);
		$news[$row['id']] = $row;
	}
 
	return $news;
}
 
 
function get_formatted_news_headers2($pattern, $num = 30, $date = NULL, $category2 = NULL)
{
	$news_formatted = '';
 
	preg_match_all('/##([^#]+)##/', $pattern, $matches);
 
	$news_headers = get_news_headers2($num, $date, $category2);
	foreach ( $news_headers as $id => $news_header )
	{
		$tmp_pattern = $pattern;
		foreach ( $matches[1] as $id => $match )
		{
			if ( 'date' === substr($match, 0, 4) )
			{
				list($match, $date_format) = explode('@', $match);
				$news_header['date'] = date($date_format, strtotime($news_header['date']));
			}
			else if ( 'title' === substr($match, 0, 5) )
			{
				list($match, $limit) = explode('@', $match);
 
				if ( $limit > 0 && strlen($news_header['title']) > $limit )
				{
					$news_header['title'] = substr($news_header['title'], 0, ($limit - 3)) . '...';
				}
			}
 
			$tmp_pattern = str_replace($matches[0][$id], $news_header[$match], $tmp_pattern);
		}
		$news_formatted .= $tmp_pattern;
	}
 
	return $news_formatted;
}
function getCouleur($i) {
	return ( $i%2 > 0 ) ? 'stoll-droite' : 'stoll-droite2';
}
?>