Code snippets for symfony 1.x


Refine Tags

Snippets tagged "asset"


This filter will automatically add css file with the name of current module.

It's great to have these files saved separately that to have one huge file. (And demo of CSSEdit doesn't allow saving files bigger than 2.5k chars :D)

Just create your cssAdderFilter.class.php, and add it to your filters.yml. Clear cache and you are ready to go.

class cssAdderFilter extends sfFilter
    public function execute( $filterChain )
        $context = $this->getContext();
        $request = $context->getRequest();
        $response = $context->getResponse();
        $module = $request->getParameter("module");
        $path_to_web = sfConfig::get("sf_web_dir");
        $path_to_css = $path_to_web . "/css/" . $module . ".css";
        if (file_exists($path_to_css))
by zero0x on 2008-05-10, tagged asset  css  filter