Page 1 of 1

Get parent page alias

Posted: Wed Nov 14, 2007 11:51 pm
by 10010110
calguy1000 wrote: Four new methods in the CustomContent module do this:

$ccuser->get_parent_alias($alias = '')  get_root_alias($alias = '') get_page_title($alias = '') has_children($alias = '')  get_parent_alias($alias = '')[/i] method? I can’t put this as smarty tag like {$ccuser->get_parent_alias($alias = '')}, this would give an error. I’m getting frustrated as I’ve been looking for a solution for this and none of the posts I found helped me because they didn’t really explain things properly. That other thread has brought me quite a step forward but I need to get the direct parent alias, not the root alias. How would I go about that?  :-\

Thanks for any help.

Re: Get parent page alias

Posted: Thu Nov 15, 2007 12:18 am
by calguy1000
{$ccuser->get_parent_page_alias()}

the = ''  stuff is code indicating that the parameter is optional.

Re: Get parent page alias

Posted: Thu Nov 15, 2007 5:52 pm
by 10010110
Thanks calguy. I must be doing something wrong, though, because if I put this as value in my template’s body’s ID I’m getting:
Fatal error: Call to undefined method ccUser::get_parent_page_alias() in […]/www/cms/tmp/templates_c/%%7E^7E8^7E8F1701%%template%3A20.php on line 34
What am I doing wrong? Do I have to put that somewhere else? I have CustomContent 1.4.10, by the way (no user set up, though, as I don’t have sepcific content for certain users to show, I only wanna get the direct parent alias).

Re: Get parent page alias

Posted: Thu Nov 15, 2007 6:01 pm
by calguy1000
OOOPS:

Code: Select all

$ccuser->get_parent_alias($alias) 
outputs the page alias of the parent page, or empty if the specified page does not have a parent (is at the top). This function will accept a page alias as an argument, if no page alias is specified, the current page is assumed.

Code: Select all

$ccuser->get_root_alias($alias)
outputs the page alias of the topmost parent page, or empty if the specified page does not have a parent (is at the top). This function will accept a page alias as an argument, if no page alias is specified, the current page is assumed.

Code: Select all

$ccuser->get_page_title($alias)
outputs the title of the page matching the supplied alias. This function will accept a page alias as an argument, if no page alias is specified, the current page is assumed.

Code: Select all

$ccuser->has_children($alias)
outputs a boolean indicating if the specified page has child pages or not. This function will accept a page alias as an argument, if no page alias is specified, the current page is assumed.

Re: Get parent page alias

Posted: Sun Nov 18, 2007 2:16 am
by 10010110
Sweet, man! That did it. Thanks a lot!  :D