En este momento tengo esta consulta a la BD:
Código PHP:
//Consulta Posts Recientes
if($id == ''){
//Consulta de posts normales
$request=db_query("
SELECT m.ID_MEMBER, m.ID_TOPIC, m.body, m.imgport, c.ID_CAT, subject, c.name, t.ID_BOARD, posterName, puntos, m.hiddenOption, posterTime, denuncias
FROM {$db_prefix}messages as m, {$db_prefix}boards as c, {$db_prefix}topics as t
WHERE c.ID_BOARD=m.ID_BOARD AND t.ID_TOPIC=m.ID_TOPIC AND t.isSticky = 0 {$cat_condition}
ORDER BY m.ID_TOPIC DESC
LIMIT $RegistrosAEmpezar,$limit_posts", __FILE__, __LINE__);
}else{
$request=db_query("
SELECT m.ID_MEMBER, m.ID_TOPIC, m.body, m.imgport, c.ID_CAT, subject, c.name, t.ID_BOARD, posterName, puntos, m.hiddenOption, posterTime, denuncias
FROM {$db_prefix}messages as m, {$db_prefix}boards as c, {$db_prefix}topics as t
WHERE c.ID_BOARD=m.ID_BOARD AND t.ID_TOPIC=m.ID_TOPIC AND t.isSticky = 0 {$cat_condition}
ORDER BY m.ID_TOPIC DESC
LIMIT $RegistrosAEmpezar,$limit_posts", __FILE__, __LINE__);
}
while($posts = mysql_fetch_array($request))
{
$context['normal_posts'][] = array(
'ID_MEMBER' => $posts['ID_MEMBER'],
'id' => $posts['ID_TOPIC'],
'body' => $posts['body'],
'imgport' => $posts['imgport'],
'title' => $posts['subject'],
'category' => $posts['name'],
'id_category' => $posts['ID_BOARD'],
'user' => $posts['posterName'],
'date' => $posts['posterTime'],
'puntos' => $posts['puntos'],
'denuncias' => $posts['denuncias'],
);
}
mysql_free_result($request);
Código PHP:
foreach ($context['normal_posts2'] as $np)
{
$hcode = array(' ',',','?');
$bcode = array('-','-','-');
$titleurl2 = str_replace($hcode, $bcode, $np['title']);
echo'<div id="fragment-'; if($cont2 <= 4) { echo $cont2; ++$cont2;} echo'" class="ui-tabs-panel '; if($cont2 <= 2) { echo $cont2; }else{ echo'ui-tabs-hide'; } echo'" >
<img width="400" src="',$np['imgport'],'" alt="',$np['title'],'" />
<div class="info" >
<a href="http://infokgeek.com/posts/', $np['id'],'/'; echo $titleurl2; echo'.html" >'; echo substr($np['title'], 0, 40); echo'...</a>
<p>';echo
substr(bbcode($np['body']), 0, 110); echo'... </p>
</div>
</div>';
}