Anson Wong
Anson Wong

Reputation: 33

Joomla article page: code to check published or not

I'm looking for php code in article page to check if the article is published or not.

I tried this one, but it false.

if($listing['Listing']['published']==1){ }

Could anyone give me some hint? Thanks a lot

PS: Joomla 1.7.3, JReviews 2.3(using Joomla default content structure)

Upvotes: 3

Views: 2502

Answers (1)

Nir Alfasi
Nir Alfasi

Reputation: 53535

Try this:

jimport('joomla.database.table');
$article_id = [place here the article Id];
$article =& JTable::getInstance("content");
$article->load($article_id);
echo $article->get("state");

you can find more info here

Upvotes: 2

Related Questions