UDT - module_link

Sezione per discutere di Moduli/Plugin sviluppati dalla comunità italiana
Locked
alby

UDT - module_link

Post 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
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: UDT - module_link

Post by calguy1000 »

alby:  have you seen the {module_action_link} function in CGSimpleSmarty ?
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.
alby

Re: UDT - module_link

Post 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
Last edited by alby on Wed Apr 30, 2008 9:10 pm, edited 1 time in total.
baki250
Forum Members
Forum Members
Posts: 22
Joined: Wed Feb 06, 2008 12:27 am

Re: UDT - module_link

Post 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
alby

Re: UDT - module_link

Post 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
Locked

Return to “Moduli/Plugins”