We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37099
    • 338 Posts
    Hi Bob

    Yes you are welcome to use the diagram. I did it in photoshop and exported it as a png.

    I did it to help me understand (and remember) how to use MyComponent and am happy to share.

    On points 5 & 7: I split the two boxes after the stub file box so that I could see when I needed to use import objects, so labeling them as you suggested and moving CSS, JS etc to the left hand box wouldn't be as clear for me because you don't need to use Import Objects if you change a CSS, JS or image file (I don't think).

    Happy to do two versions though, thanks for the feedback.

    Mike
      • 37099
      • 338 Posts
      Here's version 3. I'll do you a version with points 5 & 7 if you want, but I think that would confuse me.

        • 36573
        • 173 Posts
        First of all. Thank you thingstodo for the diagram. Being a visual person this helped immensely!

        After creating the new project do you edit both the newproject.config.php file PLUS duplicate the example.config.php chuck and also edit??

        Also all my css, js, images...etc are in assets/gazoobie. Where do I put that information in the config file so it pulls it into the component? Or do I just manually move it?

          Everything I know I learned on the internet. Saved me thousands in College tuition,
          • 3749
          • 24,544 Posts
          The newproject.config.php file (in the core/components/mycomponent directory) is basically a duplicate of the example.config.php file. It (the newproject.config.php file) is the only one you need to edit.

          The usual practice on the CSS, JSS, etc. files is to move the ones related to your project to assets/mycomponents/componentname/assets/components/componentname/. They will automatically end up in assets/components/componentname/ when the package is installed.
            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
            • 36573
            • 173 Posts
            Thanks, Bob I think I'm getting the hang of it. I successfully created a package with resources, chunks, templates and system settings. I'm attempting to create my own site starter.

            You really should put that diagram on your tutorial page. For us creative types. It helped a lot.
              Everything I know I learned on the internet. Saved me thousands in College tuition,
              • 3749
              • 24,544 Posts
              BTW, I finally got around to putting the Workflow Diagram up here: http://bobsguides.com/mycomponent-workflow.html.

              Better late than never. 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
                • 36573
                • 173 Posts
                How do I link to the css, js ....etc in the head of my templates so that after the package is made and installed it still points to the file?

                Hey, nice job getting that image up. You've just cleared the cloudiness for many creative/coders.
                  Everything I know I learned on the internet. Saved me thousands in College tuition,
                  • 3749
                  • 24,544 Posts
                  Sorry it took so long.

                  On the CSS and JS files, here's an example from the ClassExtender code:

                  $cssFile = $this->modx->getOption('ce.assets_url', null,
                      MODX_ASSETS_URL . 'components/classextender/') . 'css/classextender.css?v=' . $this->version;
                  
                  $this->modx->regClientCSS($cssFile);


                  ce.assets_url is a System Setting containing the path to the development location of the CSS file:

                  {assets_url}mycomponents/classextender/assets/components/classextender/


                  That way, on my machine, ClassExtender will use the CSS file from my MyComponents directory. When ClassExtender is installed on someone else's machine, that System Setting won't exist, so it will use the installed css file at assets/components/classextender/css/classextender.css.

                  Important: When you create the System Setting, put it in the core namespace, so MyComponent won't include it when you run ExportObjects.

                  The version is tacked on to the end for "cache-busting," so that when a new version comes out, the cached version of the older file won't be used.

                  It's the same for JS files, except that you use $modx->regClientStartupScript() instead of $modx->regClientCSS().







                    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
                    • 36573
                    • 173 Posts
                    <link rel="stylesheet" href="[[++ce.assets_url]]css/base.css">
                    <link rel="stylesheet" href="[[++ce.assets_url]]css/gazoobie.css">
                    


                    So I have this in the head. Do I put the code in the gazoobie.config file and do one for each css and js file?
                      Everything I know I learned on the internet. Saved me thousands in College tuition,
                      • 36573
                      • 173 Posts
                      OK an additional question only because I don't know php.

                      On a clean install I have a few resourses installed but when I update I don't want to update or add the resouces. What is the best way to handle this?
                        Everything I know I learned on the internet. Saved me thousands in College tuition,