I've learned to use the variables defined by cmsms in my user tags rather than using my own select queries which is really efficient. For those who don't know what they are, here's a little user tag I use to quickly pull them out and identify them:
user tag name: show_variables
Use the tag in a template like this: {show_variables}
Here's the code for the tag:
Code: Select all
global $gCms;
$pageinfo = &$gCms->variables['pageinfo'];
$page_title = $pageinfo->content_title;
$template = $pageinfo->template_id;
$menu = $pageinfo->content_menutext;
$alias = $gCms->variables['page'];
$content_id = $gCms->variables['content_id'];
$curhierarchy = $gCms->variables['position'];
$page_name = $gCms->variables['page_name'];
echo "menu text: " . $menu."<br>";
echo "template: " . $template."<br>";
echo "page title: " . $page_title."<br>";
echo "alias: " . $alias."<br>";
echo "hierarchy: " . $curhierarchy."<br>";
echo "id: " . $content_id."<br>";
echo "page name: " . $page_name."<br>";
Code: Select all
$query = "SELECT parent_id FROM cms_content WHERE content_id = '$content_id'";
$result = mysql_query($query,$dblink);
$content = mysql_fetch_assoc($result);
$parent_id = $content['parent_id'];
Code: Select all
$query = "SELECT menu_text FROM cms_content WHERE content_id = '$parent_id'";
$result = mysql_query($query,$dblink);
$content = mysql_fetch_assoc($result);
$menu_text = $content['menu_text'];
Any help is appreciated.