Show title of parent page on subpages

I had a task of showing title of the parent page when viewing subpage.
Solution was found using CGSimpleSmarty module.
First you will have to install CGSimpleSmarty module, after that you can use this snippet in your template.

{$cgsimple->get_page_title($cgsimple->get_parent_alias(), 'maintitle')}

Now you can simply use {literal}{$maintitle}{/literal} where you need to show parent title.

Update 9th November 2011

As Tetsuo asked lower in comments how to get a title from level higher then parent, here is a quick update. There are many ways to skin our CMSMS cat so here are two methods.

Method 1:

We still use CGSimpleSmarty 

{$cgsimple->get_parent_alias($page_alias, parent)}

So first we get parent alias from current page and assign it as variable $parent, then we use get_page_title as before with a difference that in second get_parent_alias function we use our assigned variable to get it'S parent alias and assign it as variable $maintitle.

Method 2

Create a new UDT and name it root_page_name with fllowing content.

$gCms   = cmsms();
$smarty = cmsms()->GetSmarty();
$manager =& $gCms->GetHierarchyManager();

$start_level = isset($params['start_level']) ? $params['start_level'] : 0;

$var = 'root_page_name';
if (isset($params['assign']) && $params['assign'] != '') {
    $var = $params['assign'];

$result   = "";
$thisPage = $gCms->variables['content_id'];

$currentNode =& $manager->sureGetNodeById($thisPage);
while (isset($currentNode) && $currentNode->getLevel() >= $start_level) {
    $currentContent =& $currentNode->getContent();
    $result = $currentContent->Name();
    $currentNode =& $currentNode->getParentNode();

$smarty->assign($var, $result);

Now you would have a tag {root_page_name} with parameter start_level and assign. This way we can always show title from for example Second level of your site structure.

{root_page_name start_level='1' assign='maintitle'}