-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathultimos_comentarios.php
41 lines (39 loc) · 1.27 KB
/
ultimos_comentarios.php
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
<table width="255" height="190">
<font size="-2">
<tr>
<td valign="top">
<?php
$sql = "
SELECT c.id, id_post, autor, p.categoria, p.titulo, cat.imagen, cat.link_categoria
FROM comentarios AS c
INNER JOIN posts AS p ON p.id = c.id_post
INNER JOIN categorias AS cat ON p.categoria = cat.id_categoria
WHERE c.elim = '0'
AND p.elim = 0
ORDER BY c.id DESC
LIMIT 0, 15";
$request = mysqli_query($con, $sql);
if (mysqli_num_rows($request) > 0) {
while ($row = mysqli_fetch_array($request)) {
$id_comment = $row['id'];
$id_post = $row['id_post'];
$category = $row['link_categoria'];
$title = $row['titulo'];
$cant = strlen($title);
$titulo2 = $cant > 24 ? substr(stripslashes($title), 0, 24) : $title;
$tit = $cant > 24 ? 1 : 0;
$url_comment = generatePostLink($id_post, $category, $title) . '#comentario_' . $id_comment;
?>
<font size="1">
<a href="<?php echo $url; ?>/perfil/<?php echo $row['autor']; ?>/" class="user_profile"><?php echo $row['autor']; ?></a>
<a href="<?php echo $url_comment; ?>" class="post_url"><?php echo $titulo2 . ($tit == 1 ? '...' : ''); ?></a>
</font>
<br />
<?php
}
}
?>
</td>
</tr>
</font>
</table>