Skip to content

Instantly share code, notes, and snippets.

@fsouza
Created May 6, 2011 02:32
Show Gist options
  • Save fsouza/958346 to your computer and use it in GitHub Desktop.
Save fsouza/958346 to your computer and use it in GitHub Desktop.
Script usado para salvar estáticos do Dev in Cachu (feião :P)
<?php
require('libs/Smarty.class.php');
require('util.php');
$smarty = new Smarty;
$smarty->assign('titulo', 'Avalia&ccedil;&atilde;o');
$html = $smarty->fetch('avaliacao.tpl');
save_cached_content($html, 'avaliacao.html');
$smarty->assign('titulo', 'Caravanas');
$html = $smarty->fetch('caravanas.tpl');
save_cached_content($html, 'caravanas.html');
$smarty->assign('titulo', '30 de abril');
$html = $smarty->fetch('index.tpl');
save_cached_content($html, 'index.html');
$smarty->assign('titulo', 'Fa&ccedil;a sua inscri&ccedil;&atilde;o');
$html = $smarty->fetch('inscricao.tpl');
save_cached_content($html, 'inscricao.html');
$smarty->assign('titulo', 'Palestrantes');
$html = $smarty->fetch('palestrantes.tpl');
save_cached_content($html, 'palestrantes.html');
$smarty->assign('titulo', 'Patroc&iacute;nio');
$html = $smarty->fetch('patrocinio.tpl');
save_cached_content($html, 'patrocinio.html');
$smarty->assign('titulo', 'Programa&ccedil;&atilde;o e Palestras');
$html = $smarty->fetch('programacao.tpl');
save_cached_content($html, 'programacao.html');
$smarty->assign('titulo', 'Quando e Onde');
$html = $smarty->fetch('quando-e-onde.tpl');
save_cached_content($html, 'quando-e-onde.html');
<?php
function save_cached_content($content, $filename) {
$fp = fopen(sprintf("/home/devincachu/static_devincachu/%s", $filename), "w");
fprintf($fp, "%s", $content);
fclose($fp);
echo "Saved: ".$filename."<br />";
}
@arthurfurlan
Copy link

Faz tempo que não via um código com Smarty, bacana! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment