Multiple Arguments to Helper File - Joomla! Forum - community, help and support


i know answer out there somewhere, challenged on finding it:

how pass multiple arguments module helper.php file , parse out values use in helper file?

============
if want details, here happening. old school, making headway on figuring out.

currently, have module sends string itself, looks characters in string in table, , return attributes of characters within string.

i can (repeating basic sql chain several times) in mod_testcode.php (only 1 record returned):

// create new query object.
$query = $db->getquery(true);

// build sql query
$query->select('strvarstring');
$query->from($db->quotename('tjm1_testdecoder'));
$query->where($db->quotename('strvariable') . '='.$db->quote(series), 'and');
$query->where($db->quotename('strvarvalue').' = '.$db->quote($series));

// reset query using our new query object
$db->setquery($query);

// load single result
$series = $db->loadresult();
=================

i have items series, market, users, years, etc, using same basic sql. send helper.php, like:

$vin_var = 'series';
$series = modtestcodehelper::getdecoder($item($vin_var, $series)); // can't right!

in helper file:

public static function getdecoder($params)
{
$att_name = $params->get('items', 0); // implodes
$att_value = $params->get('items', 1);

i know not how send multiple parameters, cause doesn't work. have spent way time looking simple example, no success. using wrong search terms.

thanks in advance ...
chris

okay.
that didn't take long. not joomla question, .php question. went understanding of arrays.

passed arguments with:

$vin_var = 'series';
$att_id = $series;
$series = modtestcodehelper::getdecoder(
array(
'vin_var' => $vin_var,
'att_id' => $att_id
)
);

good use of memory, terrible use of variables! :)

received in helper file:
$att_name = $params['vin_var'];
$att_value = $params['att_id'];

works champ. reading!





Comments

Popular posts from this blog

2.5.28 to 3.4.1---Download of update package failed - Joomla! Forum - community, help and support

Warning, the Safe Path is not accessible vm3 - Joomla! Forum - community, help and support

Joomla! Update is not offering Joomla 3 - Joomla! Forum - community, help and support