PHP script to get all article IDs joomla

 

You could use the following:

 

$query = "SELECT * FROM #__content";
$db = JFactory::getDBO();
$db->setQuery($query); 
$articles = $db->loadObjectList(); 
foreach($articles as $article){
    echo 'ID:' . $article->id . ' Title: ' . $article->title;
}

 

If you want to get all the ID’s of articles from a specific category, you could use the following:

 

$catId = 59;
$query = "SELECT * FROM #__content WHERE catid ='" . $catId . "'";
$db = JFactory::getDBO();
$db->setQuery($query); 
$articles = $db->loadObjectList(); 
foreach($articles as $article){
    echo 'ID:' . $article->id . ' Title: ' . $article->title;
}

 

Obviously you change 59 to whatever suits your needs

 

Note that this method of a database query is for Joomla 1.5

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s