[SOLVED] Parent Title TAG see my last comment

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
howey
Forum Members
Forum Members
Posts: 158
Joined: Fri Sep 14, 2007 1:05 pm

[SOLVED] Parent Title TAG see my last comment

Post by howey »

I have been searching the forum for an answer to enable me to display the parent page title/menu text on a child page.

I have found several threads that look as if they would help. But as I am a designer and not a programmer and a noobie to CMSMS I can't figure out what to do with the code.

I tied cut and pasting the code from here http://forum.cmsmadesimple.org/index.ph ... 778.0.html int a document "function.parent_title.php" and putting that into the plugins folder but it didn't work.

Another thread outlined code for a UDT? http://forum.cmsmadesimple.org/index.ph ... 733.0.html. But I still don't know how to use the code – where to put it or install it.

The site I am building is using the simple_navigation.tpl, which works for all the other navigation menus.

You can view a test page here if it helps: http://www.idaserver.co.uk/ibc/index.ph ... who-we-are. Although I am a bit worried that I will be flamed for the quality of my code – I have used tables and it may be a bit clumsy and isn't any where near strict xml.
:'(
Last edited by howey on Thu Nov 08, 2007 11:04 am, edited 1 time in total.
howey
Forum Members
Forum Members
Posts: 158
Joined: Fri Sep 14, 2007 1:05 pm

Re: Parent Title TAG

Post by howey »

Even the post just below me is a bit hard for me to follow

http://forum.cmsmadesimple.org/index.ph ... 630.0.html
RonnyK
Support Guru
Support Guru
Posts: 4962
Joined: Wed Oct 25, 2006 8:29 pm

Re: Parent Title TAG

Post by RonnyK »

I used this one,

http://forum.cmsmadesimple.org/index.ph ... l#msg41774

Where the second part is the calling of the IDT, that gives you the variable back to use.

Ronny
howey
Forum Members
Forum Members
Posts: 158
Joined: Fri Sep 14, 2007 1:05 pm

Re: Parent Title TAG

Post by howey »

The link you gave me referred to a strange

A strange "ERROR could not get module instance" in cmsms

Mmmm! confused.
RonnyK
Support Guru
Support Guru
Posts: 4962
Joined: Wed Oct 25, 2006 8:29 pm

Re: Parent Title TAG

Post by RonnyK »

Sorry my mistake, had an older link in the clipboard.

http://forum.cmsmadesimple.org/index.ph ... l#msg53453

Ronny
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Parent Title TAG

Post by Dr.CSS »

The link you gave...

First code goes in a new menu manager template...

Next three are User Defined Tags, UDT, that you will have to copy/paste into new ones on your site, naming them as they are called in the menu template...
howey
Forum Members
Forum Members
Posts: 158
Joined: Fri Sep 14, 2007 1:05 pm

Re: Parent Title TAG

Post by howey »

I'm still not getting it  :-[

Is this the link you are referring to: http://forum.cmsmadesimple.org/index.ph ... 630.0.html

I am still confused.

Do I implement the UDT in the plugins directory and then call them in the new menu template and then the menu tag on the page?

Or do I define a new UDT and call it on the page template - which then refers to the new menu template that will replace the simple_navigation.tpl

Any clarification would help – I'll then go to bed and sleep on it.
howey
Forum Members
Forum Members
Posts: 158
Joined: Fri Sep 14, 2007 1:05 pm

Re: [SOLVED] Parent Title TAG see my last comment

Post by howey »

I get it now! Doh!

Thanks Mark

I slept on it came in afresh and the penny dropped. I cut and pasted the code from the link http://forum.cmsmadesimple.org/index.ph ... 778.0.html

Code: Select all

// This is only going to step up the tree one level

global $gCms;
$content_id = $gCms->variables['content_id'];
$hm =& $gCms->GetHierarchyManager();

$node =& $hm->getNodeById($content_id);

if ($node != null)
{

    //Grab the parent node
    $parentnode =& $node->getParentNode();
    $ncontent =& $node->getContent();
    $pnode = $ncontent->ParentID();

    //Make sure something came back
    if ($pnode != -1)
    {
        //Get the actual content object
        $content =& $parentnode->getContent();
    } 
    else {
        //Ok no parent lets get the title of this node
        $content = $ncontent;
     }

     if ($content != null) //Just in case
        {
            //Display it's title
            echo $content->Name();
        }   
}
and created a new UDT (user defined tag) in the CMSMS admin under user defined tags. Then I put the tag

Code: Select all

{parent_title} 
in the page template and it worked.
Last edited by howey on Thu Nov 08, 2007 11:10 am, edited 1 time in total.
Post Reply

Return to “CMSMS Core”