• twitter image
  • facebook image
  • youtube image
  • linkedin image
Language: CMS Made Simple Czech CMS Made Simple France CMS Made Simple Spain CMS Made Simple Hungary CMS Made Simple Russia CMS Made Simple Netherlands

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Get parent alias
PostPosted: Sun Jan 16, 2011 12:08 am 
Offline
Forum Members
Forum Members

Joined: Thu Nov 11, 2010 12:30 pm
Posts: 14
Witam. Zwracam się z pytaniem dlaczego poniższy kod, dodany jako UDT działa w wersji 1.8.2 CMSMS, a w wersji 1.9.2 już nie, wywalając błąd:
Call to a member function Alias() on a non-object in /home/jakassciezka/_cms/archives/lib/content.functions.php(975) : eval()'d code on line 22
Ewentualne rozwiązania mile widziane.

Kod:
\$1:
global $gCms;
global $smarty;

$manager =& $gCms->GetHierarchyManager();

$var = 'root_page_alias';
if( isset($params['assign']) && $params['assign'] != '' )
{
  $var = $params['assign'];
}
$result = "NO RESULT";

$rows = array();

$thisPage = $gCms->variables['content_id'];
$currentNode = &$manager->sureGetNodeById($thisPage);

$i = 0;
while( isset($currentNode))
{
    $currentContent =& $currentNode->getContent();
    $result = $currentContent->Alias();
    $currentNode =& $currentNode->getParentNode();
    $rows[$i++] = $result;
}
$result = $rows[2];

$smarty->assign($var,$result);
echo $result;


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Get parent alias
PostPosted: Sun Jan 16, 2011 8:27 am 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Wed Oct 25, 2006 8:29 pm
Posts: 4968
Location: Raalte, the Netherlands
To get parent alias, you could use CGSimpleSmarty. When installed, you can call,

\$1:
The parent page alias is {$cgsimple->get_parent_alias()}


Ronny


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Get parent alias
PostPosted: Sun Jan 16, 2011 5:42 pm 
Offline
Forum Members
Forum Members

Joined: Thu Nov 11, 2010 12:30 pm
Posts: 14
Thanks, I'll try it out. But actually, getting parent alias isn't a problem for me. With the code I've used I was able to access whatever parent I wanted - whether it was only one level above in hierarchy, three, or four etc.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Get parent alias
PostPosted: Wed Jan 19, 2011 12:19 am 
Offline
Forum Members
Forum Members

Joined: Tue May 04, 2010 5:04 pm
Posts: 249
\$1:
global $gCms;
- zmienna globalna która nie działa od wersji 1.9 - to przyczyna. W twoim UDT dodaj wiersz:

$gCms = cmsms(); albo po prostu zadeklaruj globalną zmienną cmsms().

Przy okazji uwaga dla wielu PL użytkowników CMSMS - znaczna część UDT które znjadziecie na forach EN nie będzie działała właśnie z tego powodu.
BTW - Ronny dobrze Ci doradził, aby użyć CGSimpleSmarty, poza opcją parent jest tam w parę innych użytecznych tagów.

Pozdr.
Marek A.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
A2 Hosting