Page 1 of 1

UDT - module_link

Posted: Wed Apr 30, 2008 8:49 pm
by alby
module_link:
Ritorna l'url di un item di un modulo (predefinito News) ma è estensibile.
Da testare che poi lo metto sul Wiki

Code: Select all

//
// UDT for link to News/Generic Module
// Alberto Benati (alby) <cms at xme.it>
// 
// @param "id" - MANDATORY
//		The article/module item ID
//
// @param "cntnt" - optional
//		Form counter. It's not important for this example, but tomorrow...
//
// @param "origid" - optional
//		The original page (default current page), can be an ID number or an alias.
//
// @param "redirect" - optional
//		The redirect page (default current page), can be an ID number or an alias.
//
// @param "other" - optional
//		Other query params.
//
// @param "assign" - optional
//		Smarty assign variable.
//
// @example
//		{module_link id=1 redirect='News'}
//		{module_link id=1 module='Cataloger'} not implemented!
//

global $gCms;
global $smarty;


$id = 1;
if(isset($params['id']) && $params['id'] != '') $id = intval($params['id']);


$module = 'News';
if(isset($params['module']) && $params['module'] != '') $module = strtolower($params['module']);


$cntnt = '01';
if(isset($params['cntnt']) && $params['cntnt'] != '') $cntnt = $params['cntnt'];


$origid = $gCms->variables['content_id'];
if(isset($params['origid']) && $params['origid'] != '')
{
 $manager =& $gCms->GetHierarchyManager();
 $currentNode = &$manager->sureGetNodeById($params['origid']);
 $currentContent =& $currentNode->getContent();
 $origid = $currentContent->Id();
}


$redirect = $gCms->variables['content_id'];
if(isset($params['redirect']) && $params['redirect'] != '')
{
 $manager =& $gCms->GetHierarchyManager();
 $currentNode = &$manager->sureGetNodeById($params['redirect']);
 $currentContent =& $currentNode->getContent();
 $redirect = $currentContent->Id();
}


$other = '';
if(isset($params['other']) && $params['other'] != '') $other = $params['other'];
if(!empty($other)) $other = '&'.$other;


$url = $gCms->config['root_url']."/index.php?mact=";

switch($module)
{
	default:	$url .= "News,cntnt{$cntnt},detail,0&cntnt{$cntnt}articleid={$id}&cntnt{$cntnt}origid={$origid}&cntnt{$cntnt}returnid={$redirect}{$other}";
}


if(isset($params['assign']) && $params['assign'] != '')
{
 $smarty->assign($params['assign'], $url);
 return '';
}
else return $url;
Alby

Re: UDT - module_link

Posted: Wed Apr 30, 2008 8:52 pm
by calguy1000
alby:  have you seen the {module_action_link} function in CGSimpleSmarty ?

Re: UDT - module_link

Posted: Wed Apr 30, 2008 9:04 pm
by alby
calguy1000 wrote: alby:  have you seen the {module_action_link} function in CGSimpleSmarty ?
Is not fair .... leaves a little to other  :D

Alby

Re: UDT - module_link

Posted: Tue May 13, 2008 10:40 pm
by baki250
Hi Alby

I was wondering how to change the Page Alias of each Cataloger category/item to have their own page alias names. ie for english like product-a... and should change to urnler-a....

Hope to hear from you and many thanks in advance for all your support

Re: UDT - module_link

Posted: Wed May 14, 2008 10:18 am
by alby
baki250 wrote: I was wondering how to change the Page Alias of each Cataloger category/item to have their own page alias names. ie for english like product-a... and should change to urnler-a....

Hope to hear from you and many thanks in advance for all your support
Maybe OT on module_link

Say you page alias name in MLE?
Alias page and ID page in CMSMS are unique variables for each page.
Language use other variable (hl) for change your content language.
If you change alias of page you change alias to all language pages.

Alby