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

    I copied and edited the example.config.php file. MyComponent's bootstrap run encounters a problem with the array specifying the resources to add.
    Here is how I tried to add the resources named (pagetitle) "Resource1" and "Resource2":

    /* ************************* RESOURCES ****************************
         Important: This list only affects Bootstrap. There is another
         list of resources below that controls ExportObjects.
         * ************************************************************** */
        /* Array of Resource pagetitles for your Extra; All other fields optional.
           You can set any resource field here */
        'resources' => array(
            'Resource1',
            'Resource2',
        ),


    Have I misunderstood the note from the comments?

    Can anyone give an example how an item is supposed to be formed?

    Thank you in advance.

    Best regards,
    Björn

    This question has been answered by BobRay. See the first response.

    • discuss.answer
      • 3749
      • 24,544 Posts
      In the current version of MODX, you may have provide an alias and/or context_key:

      'resources' => array(
      'Resource1' => array( /* minimal example */
      'pagetitle' => 'Resource1',
      'alias' => 'resource1',
      'context_key' => 'web',
      ),
      'Resource2' => array( /* example with other fields */
      'pagetitle' => 'Resource2',
      'alias' => 'resource2',
      'context_key' => 'web',
      ),
      ),
        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
        • 53173
        • 5 Posts
        thank you, Bob. It works now.
          • 3749
          • 24,544 Posts
          I'm glad I could help.

          I'm curious about the details of your setup. I may need to change the comments and/or the docs.

          Do you have multiple front-end contexts?

          Do you have the the automatic_alias System Setting to 1? (that might have solved it).

          Did you need to include the context, or just the alias?


            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
            • 46580
            • 167 Posts
            Hi

            MyComponents is really great !
            I'm trying to create resource content but when I try
                'resources' => array(
                    'xb3a11y Homepage example' => array( /* minimal xb3a11y */
                        'pagetitle' => 'xb3a11y Homepage example',
                        'alias' => 'xb3a11y-homepage-sample',
                        'context_key' => 'xb3a11y',
                        'template' => 'a11yhome',
                        'content' => 'new content',
                        'richtext' => false,
                        'published' => true,
                    ),
            


            It's always the default content (example config : "Content goes here").

            Is there a way to put specific content in each resource created, on the same way than chunk creation (e.g./elements/resources/resource1.content.html) ?
              MODX lover
              -
              Développeur MODX / Webdesign / Solutions web
              • 3749
              • 24,544 Posts
              If you just want to have some default content of your own for all new resources or chunks, just do this:

              Find the resource Tpl in the MyComponent category under chunks.
              Duplicate it and add 'My' as a prefix on the name.
              Edit the duplicate and put whatever you want in it.

              The process is the same for chunks, but with the chunk Tpl.

              If you want to create specific content for each resource ahead of time, you can create files with the content and add 'filename' as a field in the array (see the example.config.php file).



                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