[current]
Ok. This NOT rocket-science. It is NOT very cool or effective. It simply works and is nice and short code. Templating done the quick way. I just though I'd share this cade with the world, as it is so easy to do ;)
function parsetemplate ($templatestr, $infohash) {
// replace placeholders like {foo}
// in templatestr with
// corresponding values from infohash
function lookup ($s, $h) {
if ($h{$s}) {
return $h{$s};
} else {
return "<!-- unknown: $s -->";
}
}
$result = preg_replace (
"/{(w+)}/e",
"lookup('$1', $infohash)",
$templatestr
);
return $result;
}
[ by Martin>]
[]
[]
similar entries (vs):
- work started on SBELT2 (# 14%)
- Let the world shine! (# 9%)
- work started on SBELT2 (# 8%)
similar entries (cg):
- work started on SBELT2 (# 26%)
Martin Spernau
© 1994-2003
Big things to come (TM) 30th Dez 2002
Assemble some of the elements in a group and treat the group
Oblique Strategies,
Ed.3
Brian Eno and Peter Schmidt
amazon.de Wunschliste
usefull links:
powered by SBELT