I'm working on a website for a colleague of mine, and we are experimenting with the EllMenu module. So far it seems to be doing the trick for what we want--a top level menu across the top, and a side menu down the left that contains the children of the selected top level item.
The problem: The way the template is designed, they want the title of the parent item to show above the list of children which is off in its own area and formatted totally different. Looking at the code for EllMenu and bulletmenu, I was inspired to write the following user-defined tag:
Code: Select all
global $gCms;
global $db;
$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'];
}
This seems to do what I want it to do. It appears to follow at least a couple "standards" that would guarantee it would know table prefixes, etc. Beyond the extra select on the database, I don't see too much of an issue with this code....
My question to you is, would you consider this a CMS-itically correct way to implement a tag to return the title of the parent content page? I noticed that the bulletmenu function code uses some of the more elaborate ContentManager code. Digging through that code a bit made it seem like this "hack," if you will, may be a slightly more optimized path to the one specific record/field required, but then again, a nested select isn't exactly the greatest thing...
Anyway, just looking for some expert advice from the CMS wizards.

Thanks!!
Corey