Joomla article page: code to check published or not

非 Y 不嫁゛ 提交于 2019-12-07 14:26:50

问题


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)


回答1:


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



来源:https://stackoverflow.com/questions/8777915/joomla-article-page-code-to-check-published-or-not

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!