We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25902
    • 27 Posts
    Hi all,
    Is there any way I can customise the output for the links generated from Ditto’s summary list?
    For example, I want to add author name, date created, author photo and breadcrumbs at the top of each article.

    My ditto call:
    [[Ditto_ResPerPage]]

    [[Ditto? &parents=`2` &display=`2` &commentsChunk=`Comments` &tpl=`ditto_blog` &paginate=`1` &phx=`1` &extenders=`request,summary,dateFilter,breadcrumbs` &paginateAlwaysShowLinks=`1` &filter=`id,3,2’ &tagData=`documentTags`]]

    Showing [+start+] - [+stop+] of [+total+] Articles
    [+previous+] [+pages+] [+next+]

    [[Reflect?config=`wordpress` &targetID=`71` &getDocuments=`1` &dittoSnippetParameters=`parents:2` &id=`wp`]]

    &tpl=`ditto_blog` - is the template for the summary list page, I just want something similar containing placeholders for the links when you click them.


    I tried using a workaround where I used Newspublisher &headertpl to write to my articles, but I’m unsure as to how I can pass the data for the placeholders there.
    Newspublisher call: [!NewsPublisher? &folder=`2` &canpost=`Site Admins` &formtpl=`FormBlog` &headertpl=`ditto_blog_output` &footertpl=`Comments` &makefolder=`1` &showinmenu=’0’ &clearcache=’1’ &rtcontent=`tvblogContent`!]

    ditto_blog_output would contain [+author+][+date+][breadcrumbs+] and such.

    Thanks
      • 20413
      • 2,877 Posts
      You could use a snippet like AuthorTime in the template.
        @hawproductions | http://mrhaw.com/

        Infograph: MODX Advanced Install in 7 steps:
        http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

        Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
        http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
        • 25902
        • 27 Posts
        Heyas MrHaw,
        okies... I used Newspublisher to create a header chunk on every article page before the content called ArticleHeader.

        So I have {{ArticleHeader}} followed by the content and then {{Comments}} at the bottom of every entry. {{Comments}} work fine using the jot call and stuff.

        I put in AuthorTime call in {{ArticleHeader}} but nothing shows up. Also, how can I go about putting custom fields at the top in this header such as breadcrumbs or author photo?
          • 20413
          • 2,877 Posts
          Make sure that the snippet works in template or content cached/uncached. I’ts a old snippet and has "etomite" in it...
          If your header {{ArticleHeader}} you name a chunk ArticleHeader that works with some text in it?
            @hawproductions | http://mrhaw.com/

            Infograph: MODX Advanced Install in 7 steps:
            http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

            Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
            http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
            • 25902
            • 27 Posts
            Aye, putting some random text works.. I guess newspublisher and AuthorTime just dont wanna work.

            I tried using a different method by calling separate Ditto calls based on whether it’s within a container or not.

            If it’s a folder/container:
            [[Ditto? &parents=`[*id*]` &depth=`2` &display=`2` &removeChunk=`Comments` &tpl=`ditto_blog` &paginate=`1` &extenders=`request,summary,dateFilter` &paginateAlwaysShowLinks=`1` &filter=`id,57,2’ &tagData=`documentTags`]]


            If it’s not a container:
            [[Ditto? &documents=`[*id*]` &display=`1` &tpl=`ditto_blogPage` &paginate=`1` &extenders=`request,summary,dateFilter` &paginateAlwaysShowLinks=`1` &filter=`id,57,2’ &tagData=`documentTags`]]



            Problem is, using &parents=`[*id*]` or &documents=`[*id*]` does not work. &parents=`[*id*]` would return the contents of the whole site from the root instead of just the contents of that folder. Of course using &parents=`99` and such linking directly to the id of the page works, but I have multiple containers and I make this call from within the site template itself.

            using &documents=`[*id*]` yields an sql syntax error.

            Any solutions?
              • 20413
              • 2,877 Posts
              Try search for another snippet! AuthorTime"Stamp" I think there is...
              I have this snippet from the forums:
              <?php
              $docInfo = $modx->getDocument($modx->documentIdentifier);
              $authorid = $docInfo['createdby'];
              $editedon = date(Y,$docInfo['editedon']);
              $tbl = $modx->dbConfig['dbase'].".".$modx->dbConfig['table_prefix']."user_attributes";
              $query = "SELECT fullname FROM $tbl WHERE $tbl.id = $authorid"; 
              $rs = $modx->dbQuery($query);
              $limit = $modx->recordCount($rs); 
              if($limit=1) {
                $resourceauthor = $modx->fetchRow($rs); 
                $authorname = $resourceauthor['fullname'];  
              }
              if (!$authorname == ""){
              $modx->setPlaceholder('mAuthor', $authorname);
              }
              return;
              ?>


              [[AuthorSnippet]]

              [+mAuthor+]

              ------------------
              Another one (from Breezer I think):
              <?php
              $output = '';
              $docnum = $modx->documentIdentifier;
              $val= $modx->db->getValue('SELECT `createdby` FROM `modx_site_content` WHERE `id` = '.$docnum.'');
              if ($val >= 0){
              $rs= $modx->db->getValue('SELECT `name` FROM `modx_user_roles` WHERE `id` = '.$val.'');
              }
              else {
              $val = abs($val);
              $rs= $modx->db->getValue('SELECT `fullname` FROM `modx_web_user_attributes` WHERE `internalKey` = '.$val.'');
              }
              $output .= ''.$rs.'';
              return $output;
              ?>


              http://modxcms.com/forums/index.php?topic=36091.0
              http://modxcms.com/forums/index.php?topic=26176.0
                @hawproductions | http://mrhaw.com/

                Infograph: MODX Advanced Install in 7 steps:
                http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

                Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
                http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower