We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3749
    • 24,544 Posts
    Just a note. Susan's suggestion and mine won't work very well together unless you have the snippet tag in one chunk, and separate chunks with nothing but the CSS code in them. The latter are the ones whose names are in the snippet. IOW, you don't want to send the snippet tag to regClientCSS(), just the CSS itself.

    In fact, you might not need the first chunk, since you can put the snippet tag in the Template or the page content.

    FYI, regClientCSS() will also take the URL of a CSS file rather than the raw CSS from a chunk as an argument if you prefer to use files for your CSS code.


    $modx->regClientCSS(MODX_ASSETS_URL . 'css/mycssfile.css');


      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
      • 34066 ☆ A M B ☆
      • 23 Posts
      Quote from: valpocreative at Oct 11, 2013, 01:46 AM
      Awesome, thank you both Susan & Bob.



      One more quick question. From here do I need to put:
      [[!this-snippet-we-just-created]]
      on my template or just use the TV selections as is.

      Thanks
        Tony Porto | Valpo Creative | http://www.valpocreative.com
        • 3749
        • 24,544 Posts
        See my post above yours. wink
          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
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          I'll be explaining the use of these $modx->regClient...() API functions in my presentation at MODXpo. I hadn't really realized how often I use them.
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 34066 ☆ A M B ☆
            • 23 Posts


            Quote from: BobRay at Oct 11, 2013, 01:56 AM

            FYI, regClientCSS() will also take the URL of a CSS file rather than the raw CSS from a chunk as an argument if you prefer to use files for your CSS code.


            $modx->regClientCSS(MODX_ASSETS_URL . 'css/mycssfile.css');



            Are you saying that I can have a chunk like this:

            
            
            $modx->regClientCSS(MODX_ASSETS_URL . 'css/mycssfile.css');
            
            <section id="case_study" class="clearfix">
            
            <div id="left_column">
            [[*left_content]]
            </div>
            
            	  <div id="right_column">
            
            	  [[*right_content]]
            	    </div>
            </section>
            
              Tony Porto | Valpo Creative | http://www.valpocreative.com
              • 38290
              • 712 Posts
              Quote from: valpocreative at Oct 11, 2013, 02:13 AM


              Quote from: BobRay at Oct 11, 2013, 01:56 AM

              FYI, regClientCSS() will also take the URL of a CSS file rather than the raw CSS from a chunk as an argument if you prefer to use files for your CSS code.


              $modx->regClientCSS(MODX_ASSETS_URL . 'css/mycssfile.css');



              Are you saying that I can have a chunk like this:

              
              
              $modx->regClientCSS(MODX_ASSETS_URL . 'css/mycssfile.css');
              
              <section id="case_study" class="clearfix">
              
              <div id="left_column">
              [[*left_content]]
              </div>
              
              	  <div id="right_column">
              
              	  [[*right_content]]
              	    </div>
              </section>
              

              The
              $modx->regClientCSS(MODX_ASSETS_URL . 'css/mycssfile.css');
              
              part is PHP and should be in a Snippet.
                jpdevries
                • 34066 ☆ A M B ☆
                • 23 Posts
                Pure awesomeness, I got it working thank you both. As instructed I just created a snippet that calls CSS & JS files and put this snippet w/ the tag in the chunk that I needed.

                Thank you again.

                Quote from: sottwell at Oct 11, 2013, 01:59 AM
                I'll be explaining the use of these $modx->regClient...() API functions in my presentation at MODXpo. I hadn't really realized how often I use them.

                Susan, I will def. attend if it ever comes anywhere near me. [ed. note: valpocreative last edited this post 13 years ago.]
                  Tony Porto | Valpo Creative | http://www.valpocreative.com