[Solved] Get the first parent_id in the template

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
yabune
Forum Members
Forum Members
Posts: 40
Joined: Wed Dec 05, 2007 7:28 pm

[Solved] Get the first parent_id in the template

Post by yabune »

Hi,

In the template I would like to know the first parent_id of the hierarchy of the current page.

For example, if I am in this page:

http://www.somesite.com/a/b/c

I would like to get: a

Thank you!
Last edited by yabune on Thu Dec 04, 2008 6:15 pm, edited 1 time in total.
Dee
Power Poster
Power Poster
Posts: 1197
Joined: Sun Mar 19, 2006 8:46 pm
Location: the Netherlands

Re: Get the first parent_id in the template

Post by Dee »

http://wiki.cmsmadesimple.org/index.php ... .27s_alias

Replace

Code: Select all

$result = $currentContent->Alias();
with

Code: Select all

$result = $currentContent->Id();

Regards,
D
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: Get the first parent_id in the template

Post by calguy1000 »

Installl the CGSimpleSmarty module

and use 

Code: Select all

{$cgsimple->get_root_alias()}
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
yabune
Forum Members
Forum Members
Posts: 40
Joined: Wed Dec 05, 2007 7:28 pm

Re: Get the first parent_id in the template

Post by yabune »

Thanks!
calguy1000 wrote: Installl the CGSimpleSmarty module

and use 

Code: Select all

{$cgsimple->get_root_alias()}
Post Reply

Return to “CMSMS Core”