We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 2611
    • 394 Posts
    When i do this:

    $array = array(
       'test' => array(
           'key1' => 'value1'
       )
    );
    $modx->setPlaceholders($array);


    If returns the placeholder as:
    [[+testkey1]]


    It used to be:
    [[+test.key1]]


    Is this a feature? Or a bug? Am i missing something?
      Follow me on twitter: @b03tz
      Follow SCHERP Ontwikkeling on twitter: @scherpontwikkel
      CodeMaster
      • 28215
      • 4,149 Posts
      Use $modx->toPlaceholders:

      $modx->toPlaceholders(array(
          'test' => array(
              'key1' => 'value1',
          ),
      ));
      


      setPlaceholders doesn’t use the separator. From the method definition documentation of setPlaceholders:


      * Note that unlike toPlaceholders(), this function does not add separators between the
      * namespace and the placeholder key. Use toPlaceholders() when working with multi-dimensional
      * arrays or objects with variables other than scalars so each level gets delimited by a
      * separator.
        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
        • 23491 ☆ A M B ☆
        • 1,056 Posts
        Quote from: splittingred at Dec 09, 2010, 07:46 AM

        Use $modx->toPlaceholders:

        $modx->toPlaceholders(array(
            'test' => array(
                'key1' => 'value1',
            ),
        ));
        


        setPlaceholders doesn’t use the separator. From the method definition documentation of setPlaceholders:


        * Note that unlike toPlaceholders(), this function does not add separators between the
        * namespace and the placeholder key. Use toPlaceholders() when working with multi-dimensional
        * arrays or objects with variables other than scalars so each level gets delimited by a
        * separator.

        Awesome, good to know! Having multi-dimensional support in the core is an excellent feature when using namespaced data sets.
          Mike Reid - www.pixelchutes.com
          MODx Ambassador / Contributor
          [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
          ________________________________
          Where every pixel matters.