We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 23299
    • 1,161 Posts
    Hi All,

    I am building a new 1.0.5 Evo site. I am using Ditto to aggregate a blog/articles system in a container resource. I have the snippet call, template and css working great. My client now wants to also have the last few posts automatically appear on the HOME page (in addition to them appearing on the Articles page) with different styling. The CSS I can handle, but making Ditto do its thing on two different pages (Articles, Home) at the SAME TIME is a new venture.

    This is what I have so far:

    I have a Ditto call (via a chunk) that I use for the Articles page (Id=4) that looks like this:
    <div id="dittoBlogBox">
    [!Ditto? &parents=`4` &tpl=`dittoBlogTemplate`  &display=`8` &paginate=`1`  &paginateAlwaysShowLinks=`0`  &dateFormat=`%b %d %Y` &tagData=`myTags` &tagDelimiter=`, ` &tagDocumentID=`11` &tplPaginatePage=`pageSplitter`  &paginateSplitterCharacter=`|` &orderBy=`createdon DESC` !]
    
    [+previous+] [+pages+] [+next+]
    </div>


    That works great.

    I then found a thread that used making a TV called ShowOnHomepage as a TEXT FIELD with a default value of 0.
    I then added this call to the HOME page:
    [!Ditto? &depth=`0` &parents=`0` &filter=`ShowOnHomepage,1`!]


    Now if I add pages to the Articles container the TV called ShowOnHomepage is there. If I swap the default value of 0 to a 1, I then get the article showing up on both the Articles resource and the Home page resource.

    So, I am close but what the client wants is a system that AUTOMATICALLY presents say the last four articles on the HOME page resource that were added to the Articles resource.

    How do I make this adjustment?

    Thanks!!!
      • 8609
      • 607 Posts
      I would think just adding another Ditto call to the home page would do the trick? Just add the correct parent and tpl

      [!Ditto? &parents=`4` &tpl=`dittoHomeTemplate` &display=`4` &orderBy=`createdon DESC` !]
        • 23299
        • 1,161 Posts
        Mary, thanks! I was just trying the same thing when I realized I was making this more complicated than it should be...

        EDIT: actually I think I am going to mess around trying both snippet calls AND the ShowOnHomepage TV. This way we can have all articles aggregate on the Articles container resource and have say the last 4 articles appear on the Home page. Having the TV option will also allow the client to add specific documents (like article #1 and #18 etc) to the Home page presentation as well...
          • 23299
          • 1,161 Posts
          OK this seems to work nicely.

          The last four articles are aggregated on the bottom of the Home page AND the client has the option of also adding (via the added TV) any article on the Home page below the last four articles.

          Code looks like this:
          <h3>Recent Articles...</h3>
          [!Ditto? &parents=`4` &tpl=`dittoHomeTemplate`  &display=`4` &orderBy=`createdon DESC` &tagData=`myTags` &tagDelimiter=`, ` &tagDocumentID=`11` !]
          [!Ditto? &depth=`0` &parents=`0` &tpl=`dittoHomeTemplate` &orderBy=`createdon DESC` &tagData=`myTags` &tagDelimiter=`, ` &tagDocumentID=`11` &filter=`ShowOnHomepage,1`!]

            • 8609
            • 607 Posts
            Glad you got it to work... adding the option to add an article of choice is a nice touch smiley
              • 23299
              • 1,161 Posts
              Indeed!

              I sort of stumbled on this...

              We can now have a lower area on the Home page for "Recent Articles" that can feed from the last four (or any preferred quantity) articles and an area below that for "Older Articles" that can be hand selected just by clicking the TV on the individual resources themselves. Both areas can be styled with CSS differently to sort of separate the presentation slightly. All articles will also aggregate on the master Articles page and all will function with a tagging system as well. Its clean and flexible.

              So far so good!