1
LazyBadger
Teo new smarty-plugins wanted

Can anybody write
* regex_search (with subpattern suport)
* md5sum

in smarty?
Quis custodiet ipsos custodes?

Webmaster of
XOOPS2.RU
XOOPS Modules Proving Ground
XOOPS Themes Exhibition

2
Mithrandir
Re: Teo new smarty-plugins wanted

how would they be in PHP ?
"When you can flatten entire cities at a whim, a tendency towards quiet reflection and seeing-things-from-the-other-fellow's-point-of-view is seldom necessary."

Cusix Software

3
LazyBadger
Re: Teo new smarty-plugins wanted

function md5hash ($string)
{
hash=md5($string);
return $hash;
}

function refex_search ($subj, $pattern, $found, ,,,...)
{
if (preg_match ($pattern), subj, $results)
{(... jump over all subpatterns)
while ()
{if ... $found[counter++]=$results[regexcounter]}
}
}
Quis custodiet ipsos custodes?

Webmaster of
XOOPS2.RU
XOOPS Modules Proving Ground
XOOPS Themes Exhibition

4
Mithrandir
Re: Teo new smarty-plugins wanted

md5hash() - although this is the hashing function and not a checksum check:

/*
 * Smarty plugin
 * -------------------------------------------------------------
 * Type:     function
 * Name:     md5hash
 * Purpose:  return the md5() hash of a string
 * -------------------------------------------------------------
 */
function smarty_function_md5hash($params, &$smarty)
{
    if (!
in_array('value'array_keys($params))) {
        
$smarty->trigger_error("md5hash: missing 'value' parameter");
        return;
    }

    
$hash md5($params['value']);
    return 
$hash;
}

?>

Put in a file called function.md5hash.php and place it in /class/smarty/plugins and you will be able to use <{md5hash value="string_to_hash"}> in your templates.

if you write out the PHP function of the regex completely, I'll do that, too.
"When you can flatten entire cities at a whim, a tendency towards quiet reflection and seeing-things-from-the-other-fellow's-point-of-view is seldom necessary."

Cusix Software

Login

Who's Online

290 user(s) are online (143 user(s) are browsing Support Forums)


Members: 0


Guests: 290


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Aug 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits