Members: 16,816
Threads: 38,946
Posts: 160,349
Online: 199

Newest Member: Dirk Ahlemeyer


Odoo.tv - Outdoor Television


Sedo - Domains kaufen und verkaufen das Projekt mambers.com steht zum Verkauf Besucherstatistiken von mambers.com etracker® Web-Controlling statt Logfile-Analyse
Old 12.07.2005, 15:40   #1 (permalink)
Baby Mamber
 
Join Date: Jul 2005
Posts: 1
ddelaneymdw is on a distinguished road
Default Custom Parameter Hack

I modified the mamboxml.php file to include support for using custom parameters in the module setup xml file. I know that you can extend the parameters by extending the mosParameters class. However, no where in the core code (or documentation) can you tell the administration side to use the new class instead of mosParameter without adding functions directly to the mosParameters class.

With that being said, here is an example of the XML setup file for a module with a custom parameter type that will get the categories for newsfeeds:

<params>
<param name="nfcat" type="nfcatlist" default="" label="Cats" description="" />
</params>

<customparam name="nfcatlist">
global $database;
$database->setQuery("SELECT id,name FROM `#__categories`"
. " WHERE section='com_newsfeeds' ORDER BY name");

$options = $database->loadObjectList();
array_unshift($options, mosHTML::makeOption('0','- Select Category -'));

$CustomParamResult = mosHTML::selectList(
$options,"mdwnfcatlist", "class=\"inputbox\"",
'id', 'name',"");
</customparam>

The customparam tage must have a name attribute that matches the type attribute from the param tag above and store output in a variable $CustomParamResult.

Here is the modified render_param function from the mosParameters class:

function renderParam( &$param, $control_name='params' )
{
$result = array();
$name = $param->getAttribute( 'name' );
$label = $param->getAttribute( 'label' );

$value = $this->get( $name, $param->getAttribute( 'default' ) );
$description = $param->getAttribute( 'description' );

$result[0] = $label ? $label : $name;
if ( $result[0] == '@spacer' ) {
$result[0] = '<hr/>';
} else if ( $result[0] ) {
$result[0] .= ':';
}

$type = $param->getAttribute( 'type' );

if (in_array( '_form_' . $type, $this->_methods )) {
$result[1] = call_user_func( array( &$this, '_form_' . $type ), $name, $value, $param, $control_name );
} else {

/************************************************** *********/
/* Customized to include custom parameter handlers in the */
/* xml setup file. (Daniel Delaney, mydigitalway.com) */
/************************************************** *********/

$customParams = & $this->_xmlElem->parentNode->getElementsByTagName("customparam");
if($customParams->getLength() > 0)
{
for($i = 0; $i < $customParams->getLength(); $i++)
{
$customParam = $customParams->item($i);
if($customParam->getAttribute("name") == $type)
{
$i = $customParams->getLength() + 1;
eval($customParam->getText());
$result[1] = $CustomParamResult;
}
else
{
$result[1] = _HANDLER . ' = ' . $type;
}
}
}
else
{
$result[1] = _HANDLER . ' = ' . $type;
}

/************************************************** *********/
}

if ( $description ) {
$result[2] = mosToolTip( $description, $name );
} else {
$result[2] = '';
}

return $result;
}
ddelaneymdw is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
Old 14.02.2006, 03:18   #2 (permalink)
Senior Mamber
 
ehsabbi's Avatar
 
Join Date: Sep 2004
Posts: 131
ehsabbi is on a distinguished road
Default Re: Custom Parameter Hack

Hi ddelaneymdw,

It means that I can change the default settings to the contents parameters?
ehsabbi is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Main Menu Image hack ssdesign Template Discussions 35 29.04.2008 10:44
Dynamic Content Images .. content.html.php hack Kerry Seibold Mambots 3 25.07.2005 00:37
Art*ContentFooter Hack wolfi Neuigkeiten 12 01.06.2005 22:50
Need Help with Template -peter- Template Discussions 5 15.04.2005 08:41
Parameter bei com_contacts jappo Komponenten 1 13.03.2005 19:57


All times are GMT +2. The time now is 09:47.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.1.0
A vBSkinworks Design
© Copyright 2004-2008 by Arthur Konze Webdesign.