Skip to content

Instantly share code, notes, and snippets.

@jaredhoyt
Created October 5, 2010 22:16
Show Gist options
  • Save jaredhoyt/612447 to your computer and use it in GitHub Desktop.
Save jaredhoyt/612447 to your computer and use it in GitHub Desktop.
class PdfHelper extends AppHelper {
var $helpers = array('Html');
function css($path) {
if (is_array($path)) {
foreach ($path as $i) {
echo $this->css($i);
}
return;
}
if (strpos($path, '?') === false) {
if (substr($path, -4) !== '.css') {
$path .= '.css';
}
}
$url = WWW_ROOT . 'css' . DS . $path;
if (!file_exists($url)) {
return;
}
return sprintf($this->Html->tags['style'], '', preg_replace('/\[[a-z]+="[a-z]+"\]/i', '', file_get_contents($url)));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment