Welcome, Guest. Please login or register.
Did you miss your activation email?
19 Mar 2010, 06:28

Login with username, password and session length
Home Chat Help Search Calendar Login Register
Pages: [1]
Print
Author Topic: UDT - module_link  (Read 3982 times)
0 Members and 1 Guest are viewing this topic.
alby
Member Support Team
Moderator
Power Poster
*****

Karma: 139
Offline Offline

Posts: 4687

Location: Ferrara, Italy


My kids


« on: 30 Apr 2008, 16:49 »

module_link:
Ritorna l'url di un item di un modulo (predefinito News) ma estensibile.
Da testare che poi lo metto sul Wiki

Code:
//
// 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 = '&amp;'.$other;


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

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


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

Alby
Logged

calguy1000
CMS GURU - 2nd Tier Support.
Dev Team Member
Power Poster
*****

Karma: 154
Offline Offline

Posts: 4733

Location: Formerly in Calgary, Canada

Gravatar

Second Tier support


WWW
« Reply #1 on: 30 Apr 2008, 16:52 »

alby:  have you seen the {module_action_link} function in CGSimpleSmarty ?
Logged

Questions relating to my modules are answered to paying customers, or when I have the time and motivation to.
----------------
Don't make me angry..... you won't like me when I'm angry....
Follow me on twitter
alby
Member Support Team
Moderator
Power Poster
*****

Karma: 139
Offline Offline

Posts: 4687

Location: Ferrara, Italy


My kids


« Reply #2 on: 30 Apr 2008, 17:04 »

alby:  have you seen the {module_action_link} function in CGSimpleSmarty ?

Is not fair .... leaves a little to other  Cheesy

Alby
« Last Edit: 30 Apr 2008, 17:10 by alby » Logged

baki250
Forum Members
**

Karma: 0
Offline Offline

Posts: 16


« Reply #3 on: 13 May 2008, 18:40 »

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
Logged
alby
Member Support Team
Moderator
Power Poster
*****

Karma: 139
Offline Offline

Posts: 4687

Location: Ferrara, Italy


My kids


« Reply #4 on: 14 May 2008, 06:18 »

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
Logged

Pages: [1]
Print
Jump to: