By Mist on Monday, 07 April 2014
Replies 5
Likes 0
Views 1.3K
Votes 0
Do you need to output total blog post count in your joomla template, anywhere "outside" EasyBlog environment ? Maybe you want to build your own statistics or display your data in a certain way or in a certain location across your site. This query will help you.

Use the code below

<?php
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query = 'SELECT COUNT(1) FROM #__easyblog_post';
$db->setQuery( $query );
$count = $db->loadResult();
echo $count;
?>


This will query the database and display the total posts count for EasyBlog.
To place the total posts count in a joomla template position, use one of the "custom code" modules (one that will run PHP) found in Joomla Extension Directory.

Enjoy !
Mist,

Thank you for the excellent tutorial. I look forward to learning more.
·
Monday, 07 April 2014 13:54
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello,

Thanks for sharing!
·
Monday, 07 April 2014 14:05
·
0 Likes
·
0 Votes
·
0 Comments
·
Great share Mist
·
Monday, 07 April 2014 18:01
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks for the kind words.
Not a problem, i will share whenever i think i have something usefull that can save others some time !
·
Monday, 07 April 2014 21:40
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Mist,

Thanks, we appreciate that.
·
Monday, 07 April 2014 21:58
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post