Skip to content

Instantly share code, notes, and snippets.

@pabloprogramador
Created December 19, 2013 11:22
Show Gist options
  • Save pabloprogramador/8037770 to your computer and use it in GitHub Desktop.
Save pabloprogramador/8037770 to your computer and use it in GitHub Desktop.
Mustache
<?php
$vars = array(
'cumprimento' => $this->_saudacao(),
'cliente' => $cliente->NOME_CLIENTE,
'tratamento' => $cliente->SEXO ? 'Senhora' : 'Senhor',
'atendente' => $_SESSION['nomeUsuario'],
'botao_financeiro' => '<a href="#?keepThis=true&TB_iframe=true&height=400&width=700" class="botao thickbox">Verificar Valores</a>'
);
$mustache = function ($valor,$vars){
return preg_replace_callback('/{{\s*(\w+)\s*}}/', function (array $m) use ($vars) {
return $vars[$m[1]];
}, $valor);};
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment