Joomla plugin : how to get article title and article id

pravin picture pravin · May 19, 2011 · Viewed 40.1k times · Source

I have developed on simple plugin in Joomla 1.6 I stuck at : How to get article title and article url.

I am getting no output if tried to print below statement:

echo $article->title;
echo $article->id;

I have written this in php file, not used MVC architecture. Is there any other settings need to do in Joomla admin side ?

Please suggest your pointers for extracting article title and article url.

Thanks in advance!

Pravin

Answer

Asaf picture Asaf · May 19, 2011

In order to get the article ID you have to write the following:

echo JRequest::getVar('id');

For the title, you just take the id you got, load the article object

$blabla = $article->load(ID);
echo $blabla->get('title');