We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 31410
    • 66 Posts
    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
      • 3749
      • 24,544 Posts
      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();


        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 32699 ☆ A M B ☆
        • 427 Posts
        I would like to see the working copy of this snippet.
          Get your copy of MODX Revolution Building the Web Your Way http://www.sanitypress.com/books/modx-revolution-building-the-web-your-way.html

          Check out my MODX || xPDO resources here: http://www.shawnwilkerson.com
          • 31410
          • 66 Posts
          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