This text is replaced by the Flash movie.

Posts Tagged ‘Joomla 1.5 Component’

Joomla 1.5 Article Trash

December 4th, 2010
While debugging the component I created I noticed that the query was returning some articles I didn't knew existed. I found out that these articles are just trashed.

The simple way to separate article trash from active articles is to get the state datafield of the table #__content equals to 1.

1
2
3
4
5
6
7
8
9
10
11
$query = "SELECT a.*, n.*, t.*, n.link as linkThisPage"
. "\n FROM #__componentnews_news AS n"
. "\n LEFT JOIN #__content AS a ON a.id = n.pr_id"
. "\n LEFT JOIN #__componentnews_types AS t ON t.id = n.type_id"
. "\n WHERE ( a.state = 1 )"
. "\n AND ( a.publish_up = " .$database->Quote($nullDate) 
. " OR a.publish_up <= " . $database->Quote($now) . ")"
. "\n AND ( a.publish_down = " . $database->Quote($nullDate)
. " OR a.publish_down >= " . $database->Quote($now) . " )"
. "\n ORDER BY $orderby"
. "\n limit $skip," . $count;

Where in this query . "\n WHERE ( a.state = 1 )" should do it.