Page 1 of 1

Template variable for parent title?

Posted: Wed Nov 18, 2009 4:14 pm
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.

Re: Template variable for parent title?

Posted: Mon Nov 23, 2009 3:03 pm
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??

Re: Template variable for parent title?

Posted: Mon Nov 23, 2009 4:26 pm
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

Re: Template variable for parent title?

Posted: Mon Nov 23, 2009 4:45 pm
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