Template variable for parent title?

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
catfish
Forum Members
Forum Members
Posts: 17
Joined: Wed Nov 18, 2009 4:06 pm

Template variable for parent title?

Post by catfish »

I'm looking for a template variable for the parent article's title and URL, so I can link back to it directly to the parent from an article - but breadcrumbs wasn't what I was looking for. Is this possible? I didn't see any template variables that seemed to suit what I need.
catfish
Forum Members
Forum Members
Posts: 17
Joined: Wed Nov 18, 2009 4:06 pm

Re: Template variable for parent title?

Post by catfish »

Still working on this, and by adding something like:

{$content_obj|print_r}

I see various interesting variables that are close, but no cigar. For example, I see:

    [mId] => 109
...
    [mParentId] => 104
...
    [mHierarchyPath] => parent_alias/article_alias

where mId is the current article's ID, parent_alias is the parent article's alias, and mParentId is the parent's article ID. Is there some nifty call I can use in the template to actually fetch the parent article and get the details from there??
klenkes
Power Poster
Power Poster
Posts: 307
Joined: Mon Sep 08, 2008 9:43 am

Re: Template variable for parent title?

Post by klenkes »

Hi.

You can always install the module CGSimpleSmarty and use the functions that come with it.

For example:

Code: Select all

{$cgsimple->get_parent_alias(['',$your_var)}
Assign the alias to the variable $your_var
Then:
{$cgsimple->get_page_title($your_var,'$pagetitle')}

The parent's page tiltle is: {$pagetitle}
Didn't test it but just read the help file! It's quite easy.

Bernd
catfish
Forum Members
Forum Members
Posts: 17
Joined: Wed Nov 18, 2009 4:06 pm

Re: Template variable for parent title?

Post by catfish »

Hey, Thanks for the tip! I've implemented it almost just like this, and it does (almost) exactly what I need. :)

The only problem now, which I have worked around be restructuring my pages, is that I am using some "External link" entries, and they have children. From the child, I can't seem to get the external link page URL in a clever way using $cgsimple. I posted a question about this in a relevant thread I found here:

http://forum.cmsmadesimple.org/index.ph ... #msg186293
Post Reply

Return to “CMSMS Core”