We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 1607
    • 72 Posts
    Help me get placeholder content with modx api.
    I have DITTO:
    [!Ditto?  &tpl=`proba` &parents=`114` &depth=`10` &display=`5` &hideFolders=`1`!]

    with chunck:
    <div><a href="[~[+id+]~]" title="[+pagetitle+]" class="reflect_item_link">[+pagetitle+]</a></div>
    [[VOSTOKKKK]]
    <br>

    Chunck used snippet VOSTOKKKK:
    <?php
    ?>
    333:::[+pagetitle+]
    <?php
    echo "<br>777:::".$modx->getPlaceholder('pagetitle');
    ?>

    I see on my page:
    ------------------------------------------------
    ASP Linux
    333:::ASP Linux
    777:::
    Microsoft Office 2007
    333:::Microsoft Office 2007
    777:::
    ------------------------------------------------
    At first line I see usual DITTO data.
    At line with 333 I see placeholder content.
    At line with 777 I want to see placeholder content too - such as at first and second lines. But I can’t see it.
    Why?
      • 33992 ☆ A M B ☆
      • 455 Posts
      MODx uses eval() to execute snippets and the input code does not have to contain PHP Opening tags.
      I guess this is problem...
        God loves me. 【ツ】


        MODX.ir (Persian Support)

        Boplo.ir/modx/ (Persian)
        • 1607
        • 72 Posts
        It’s interesting problem! I use such construction at another place - and it works!
        I have:
            $params['tpl'] = $cat_tpl;
            $params['orderBy'] = $orderBy;
            $params['format'] = xml;
            $params['parents'] = $_GET['p1'];
            $params['depth'] = 3;
            $params['display'] = $cat_display;
            $params['hideFolders'] = 1;
            $params['paginate'] = 1;
            $params['paginateAlwaysShowLinks'] = 1;
            $params['noResults'] = 'No Documents Found';
            $output = $modx->runSnippet('Ditto', $params);
        
        $cat_totalPages = $modx->getPlaceholder("totalPages");

        This $cat_totalPages used for creating paging menu.
        But!!!
        When I create thes - it don’t work. But some days later begin work without my efforts. And work now. And I want use this construction in another place. But it’s don’t work.
        It’s very interesting!

        STEP template is your’s? It’s very-very good!
          • 33992 ☆ A M B ☆
          • 455 Posts
          Quote from: Andrey_V at Feb 17, 2009, 11:01 AM
          STEP template is your’s? It’s very-very good!
          me? STEP template has designed by Banzai (tattoocms.it)
            God loves me. 【ツ】


            MODX.ir (Persian Support)

            Boplo.ir/modx/ (Persian)
            • 3749
            • 24,544 Posts
            When things don’t work at first but work later without you doing anything, it usually means you forgot to clear the site cache and your browser cache/cookies after making the changes, so you’re seeing the version from before you fixed it. smiley
              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
              • 36592
              • 970 Posts
              Hmm... is [+pagetitle+] in the Ditto template really a placeholder ?
              I think it’s a modx variable, so it can not be retrieved with getPlaceholder() function.

              I may be wrong because I’m a begginer... embarrassed
                • 1607
                • 72 Posts
                To BobRay
                Not so easy. Code with
                $cat_totalPages = $modx->getPlaceholder("totalPages");

                But if I do (for example)
                $cat_pagetitle = $modx->getPlaceholder("pfgetitle");

                it’s don’t work.
                Cash is not my problem.
                  • 7231
                  • 4,205 Posts
                  pagetitle and other document variables are not considered placeholders by the parser. You need to use the document api calls like:

                  $docId = "1";
                  $docFields = "pagetitle";
                  $doc = $modx->getDocument($docId, $docFields);
                  return $doc['pagetitle]';


                  http://wiki.modxcms.com/index.php/API:getDocument
                    [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

                    Something is happening here, but you don&#39;t know what it is.
                    Do you, Mr. Jones? - [bob dylan]
                    • 10449
                    • 956 Posts
                    <offtopic>

                    Quote from: Andrey_V at Feb 18, 2009, 12:38 AM

                    Cash is not my problem.

                    I wish I could say that grin

                    </offtopic>
                      • 1607
                      • 72 Posts
                      To dev_cw
                      Thank you! It’s very good if I used it not with DITTO!
                      If I try used with Ditto - I must get ID? but I can’t do it!

                      I try format output field. Ditto give me (for example) price: 125879345.24897. It’s bad! I want 125 879 349.24
                      I try to get value of placeholder and format it with PHP. But I can’t to get value!
                      May be somebody know another way?