Code: Select all
global $gCms;
$db =& $gCms->GetDb();
$vars =& $gCms->variables;
$query = "SELECT content_name FROM "
.cms_db_prefix()
."content WHERE content_id = (SELECT parent_id FROM "
.cms_db_prefix()
."content WHERE content_id = '"
.$vars['content_id']
."');";
$dbresult = $db->Execute($query);
if ($dbresult && $dbresult->RowCount() > 0) {
$row = $dbresult->FetchRow();
echo $row['content_name'];
} else {
echo $vars['pageinfo']->content_menutext;
}
But it doesn't work. It gives the following error:
Could anyone point me to a bit of code that will do the same thing and work in 1.4.1?Fatal error: Call to undefined function: rowcount() in ...my domain...../lib/content.functions.php(854) : eval()'d code on line 15
Even better, what I really need, is this function to echo the parent title if (and only if) the page it's on is at a certain level. For example, if the page is on level 3 I want to get the title of it's parent (level 2). But if the page in question is already at level 2 then I want it to just return the current page's title rather then the parents. So basically it's always showing the level 2 title regardless of whether the page is on level 2 or anything deeper.
Could someone help me out with that? I'd be very grateful.
Thanks.