hello
i was trying to insert many css files into one place with a snippet
its working perfectly without modx revo (or in simple php)
my testsnippet is
ob_start("compress");
function compress($buffer) {
/* remove comments */
$buffer = preg_replace(’!/\*[^*]*\*+([^/][^*]*\*+)*/!’, ’’, $buffer);
/* remove tabs, spaces, newlines, etc. */
$buffer = str_replace(array("\r\n", "\r", "\n", "\t", ’ ’, ’ ’, ’ ’), ’’, $buffer);
return $buffer;
}
/* my css files */
include($modx->getoption(’assets_url’).’templates/new/css/grids-min.css’);
include($modx->getoption(’assets_url’).’templates/new/css/reset-min.css’);
include($modx->getoption(’assets_url’).’templates/new/css/global.css’);
include($modx->getoption(’assets_url’).’templates/new/css/nav.css’);
ob_end_flush();
and iam trying to incude it in my template with
<style type="test/css">
[[testsnippet]]
</style>
but i cant see the output buffer in web page
am i doing anything wrong here?
thanks
venu
I think you want assets_path rather than assets_url.
To make sure the files are being read, you could use this for debugging:
return ob_get_contents();
-
☆ A M B ☆
- 427 Posts
I would like to see the working copy of this snippet.
sorry a bit late
yes the mistake is with using assets_url instead of assets_path
its working fine
able to save many http requests by using this snippet for css
(not sure anyone use this or not but if you use make sure background images in css use absolute path)
Thanks bob
venu