We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 16085
    • 203 Posts
    going down the PHx route I’ve used as I still can’t figure out the Ditto call..
    <div class="content-NewsInfo"><b>Article by:</b> [+phx:userinfo=`fullname`+]</div>
    <div class="content-NewsInfo"><b>Article by:</b> [+phx:userinfo=`username`+]</div>

    ..I didn’t realise that this only works when the user is logged in.. I thought this would display the username of the publishedby similar to the Ditto [+author+]!?

    Please help as the template method with PHx is working as expected. I just need the author/publisher name! smiley

    Thanks
      • 16085
      • 203 Posts
      I have solved my problem, although not 100% sure what’s caused it.

      It wasn’t the Ditto call it was the tags used in the main-news-TPL. It seemed I should have been using [*#pagetitle*] & [*#content*] and not the placeholders [+#pagetitle+] & [+#content+].

      When I use [+#pagetitle+] I can QuickEdit the title, but the pagetitle wasn’t corresponding to the correct page. I.e old new article displaying newest pagetitle. When I changed it to [*#pagetitle*] I loose QuickEdit but the correct pagetitle displays.

      It’s now works as expected’ish... grin

      Thanks for the various help form people.

      Ditto Call:
      [!Ditto? &tpl=`main-news-TPL` &parents=`9` &display=`1`!]

      Template Chunk:
      	<div class="content-News">  
      		<h1>[*#pagetitle*]</h1>  
      		<div class="content-NewsInfo"><b>Posted:</b> [+createdon:date=`%a %d, %b, %Y - %H:%M`+]</div>
      <div class="content-NewsInfo"><b>Article by:</b> [+author+]</div>
      			<div class="ditto_introText">[*#content*]</div>
      	</div>
        • 18397
        • 3,250 Posts
        Placeholders like [+pagetitle+] are the correct way of accessing document information. [*documentObject*] style items were only supported pre MODx 0.9.2.

        Try using [+placeholders+] without the quickedit # sign and see what happens. Also, you might want to look at [+date+] and &dateFormat instead of the PHx call.
          • 16085
          • 203 Posts
          @Mark, Ditto guru! smiley

          FYI:
          MODx: 0.9.6.1B
          Ditto: 2.0.2

          I’ve changed my Ditto call to use:
          &dateFormat=`%a %d, %b, %Y - %H:%M`
          with the [+date+]and that works perfectly.

          I tried [+pagetitle+] & [+content+] but I get the original issue again. The newest pagetitle & content displaying in a past article. If I change it back to [*pagetitle*] & [*content*] it displays the correct pagetitle & content. Weird. Definitely something going on with the [+placeholders+] for those tags.

          It’s not a major problem with missing out the hash [*#*] as I can still access the overall page via QuickEdit floating menu.
            • 7231
            • 4,205 Posts
            I tried [+pagetitle+] & [+content+] but I get the original issue again. The newest pagetitle & content displaying in a past article. If I change it back to [*pagetitle*] & [*content*] it displays the correct pagetitle & content. Weird. Definitely something going on with the [+placeholders+] for those tags.
            What do you get if you set &display=`3`? If using [* *] you should see the same content repeated for each article. If using [+ +] you should see 3 different sets of content corresponding to the articles returned by Ditto.
              [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]
              • 16085
              • 203 Posts
              @dev_cw, changed the Ditto call to:
              [!Ditto? &tpl=`main-news-TPL` &parents=`9` &display=`1` &dateFormat=`%a %d, %b, %Y - %H:%M` &display=`3`!]
              and main-news-TPL to:
              <div class="content-News">  
              		<h1>[+pagetitle+]</h1>  
              		<div class="content-NewsInfo"><b>Posted:</b> [+date+]</div>
              		<div class="content-NewsInfo"><b>Article by:</b> [+author+]</div>
              		<div class="ditto_introText">[+content+]</div>
              		<div class="content-NewsInfo">[+previous+] [+pages+] [+next+] </div>	
              	</div>
              expected output was 3 articles displaying newest to oldest. If I visit a really old article with [+] it will still display the 3 newest to oldest and not the article in question, ie. old article then the 2 newest below like you think it would.

              Change the main-new-TPL to:
              <div class="content-News">  
              		<h1>[*pagetitle*]</h1>  
              		<div class="content-NewsInfo"><b>Posted:</b> [+date+]</div>
              		<div class="content-NewsInfo"><b>Article by:</b> [+author+]</div>
              		<div class="ditto_introText">[*content*]</div>
              		<div class="content-NewsInfo">[+previous+] [+pages+] [+next+] </div>
              expected output was the same news article repeated 3 times.
                • 7231
                • 4,205 Posts
                If I visit a really old article with it will still display the 3 newest to oldest and not the article in question, ie. old article then the 2 newest below like you think it would.
                OK, now I think I am understanding where we are getting confuses. You have this Ditto call on all of your news article documents. I think that everyone is thinking that this is on a news index page and not the actual news article page. Am I correct? grin

                In most cases this sort of setup is used to show a that is not the actual document you are in. Like if you want to get the latest news article and have it show up on the home page. Or to have a news article index.

                In a site structure like this:
                Home
                News
                --Article
                --Article2
                --Article3
                --Article4
                --Etc...
                You would normally have this ditto call on the Home or the News pages but not in the Article pages. You can display the content directly without ditto on those pages.
                  [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]
                  • 16085
                  • 203 Posts
                  @dev_cw, yes, spot on! smiley I was finding it hard to understand what I’d done but I knew roughly what doing. If that makes sense. At the moment [**] is working until there is a better understanding by myself.

                  In one of my alternative idea I did use main-news-TPL within the News template body. But the problem I was having was displaying the post date and published by. The only way I’d got around this was to use PHx on the date, but I couldn’t find on that would display the user who published the article. I tried using userinfo=`fullname` but I found this only worked for who every was logged in at the time.

                  I’ve found a AuthorTimestamp snippet which I think will do the job. http://modxcms.com/AuthorTimestamp-693.html

                    • 16085
                    • 203 Posts
                    Okay, just to update anyone following this I can get the same results using the AuthorTime http://modxcms.com/AuthorTimestamp-693.html snippet rather then pulling on Ditto. So now it’s using a template rather then some unnecessary Ditto or PHx calls, which is what I wanted.
                    	<div class="content-News">  
                    		<h1>[*#pagetitle*]</h1>  
                    		<div class="content-NewsInfo">[[AuthorTime? &dateFormat=`%a %d, %b, %Y - %H:%M` &usedDate=`createdon` &tpl=`<b>Posted:</b> [+Date+] <br /> <b>Article by:</b> [+Author+]`]]</div>
                    		<div class="ditto_introText">[*#content*]</div>	
                    	</div>


                    smiley