Display Category Title module in Joomla

Code Craft

$title = “”;
if ($option == “com_content”) {
if ($view == “article”) {
$my_id = $db->Quote( $db->getEscaped( (int)$id ) );
$query = “SELECT cat.title ”
. ” FROM #__categories cat, #__content a WHERE a.catid = cat.id”
. ” and a.id = $my_id AND a.state = 1″;
$db->setQuery( $query, 0, 1 );
$row = $db->loadObject();
if ($row != null) $title = $row->title;
}
if ($view == “category”) {
$my_id = $db->Quote( $db->getEscaped( (int)$id ) );
$query = “SELECT cat.title ”
. ” FROM #__categories cat WHERE ”
. ” cat.id = $my_id”;
$db->setQuery( $query, 0, 1 );
$row = $db->loadObject();
if ($row != null) $title = $row->title;
}
}
if ($title != “”) echo “<h3>$title</h3>”;
/* (or whatever you want to do with the title) */

View original post

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s