[SOLVED] get page alias in UDT for use in admin page templat
Posted: Wed Jan 28, 2015 7:29 pm
I need to be able to get the page alias in a UDT which is used in admin in a page template. This to use the dropdown_from_udt in ECB module for which I am trying to pull data from certain content blocks from the same page which I can do if the alias is in the UDT. It isn't possible to pass a Smarty param to the UDT. I just don't know the api syntax for doing this.
I tried using $content_obj->Alias() but it doesn't work.
I tried using $content_obj->Alias() but it doesn't work.
Code: Select all
$result = false;
$gCms = cmsms();
$contentops = $gCms->GetContentOperations();
$content_obj = $contentops->getContentObject();
$result = Array();
// $alias = "events-test"; THIS WORKS
$alias = $content_obj->Alias();
if( $alias != '' ) {
$content = $contentops->LoadContentFromAlias($alias);
if(is_object($content)) {
for ($i=1;$i<=2;$i++) {
$block = 'speaker_name_' . $i;
$result[$content->GetPropertyValue($block)] = $content->GetPropertyValue($block);
}
}
}
return $result;