I want to print the Article id next to the title and I need to get an article id. I used this code:

$article_id = JRequest::getVar('id');
echo $article_id;

And it works great when I'm in article view (article layout). If I try to use this code in the category view (blog layout), I get the category id instead of the article id. How can I get article id in blog layout?

Thanks in advance! Regards, Midhat

1 Answer 1


In both cases you should access the article's object id property. By the way, do note that JRequest is deprecated.

For the article, in your article template you can add next to the article's title the:

echo $this->item->id;

For the category blog title, we are actually talking about the same (as the blog layout is looping through the articles of a category, so you still have access to each article object properties. However the difference here is that the category blog article title layout is handled via the JLayouts.

You will need to override the following file:


Inside there you can find the article object in the $displayData variable. So for the id:

echo $displayData->id;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.