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

    I am a articles blog like so:

    (parent) Category: News
    (child) article: news-1 written by author-tom
    (child) article: news-2 written by author-bill

    (parent) Category: Sports
    (child) article: sports-4 written by author-bill
    (child) article: sports-7 written by author-jack

    (parent) Category: Weather
    (child) article: weather-1 written by author-tom
    (child) article: weather-3 written by author-jack


    Author name is a template_variable. And for each article I input the author name manually.

    The author names are clickable links. And what I want to achieve is that when a user clicks author-bill, for example, that he only sees ALL articles written by "bill", thus articles news-2 and sports-4. Etc.

    How would I go about realising this? Sadly I cannot allocate a child to multiple parents (i.e. to both the news category and to author-jack for example... sad)

    Any help or pointers will be much appreciated.
    [ed. note: ronbonqqq last edited this post 11 years, 7 months ago.]
      • 49667
      • 59 Posts
      OK, the Ditto &filter parameter could do the trick. Just how exactly???
        • 49667
        • 59 Posts
        This is what works...

        [!Ditto? &parents=`13,23,26` &filter=`written-by,John Doe,1`!]


        I have a template_variable called "written-by" which is a drop-down menu with all authors...
        - John Doe
        - James Bond
        - Billy Bob
        - Tom Jones
        etc.

        But how do I include ALL my authors in the Ditto call with the &filter parameter???

        There is one template for ALL authors the same with the above Ditto call.

        So when a user clicks "James Bond" he/she goes to the default authors-template and should see ALL blogposts by James Bond only. The same for "Tom Jones", etc. With my above Ditto call, all authors show "John Doe" blogposts... sad
          • 13226
          • 953 Posts
          I wanted to answer this earlier but I wasnt sure If I was on the right lines.

          Now, I am sure - there is no difference to Tagging - you are tagging a post with a name

          So, why don't you set it up as such ?

          Links:

          Category Tagging with Ditto
          Tagged blogging with Ditto
          tagLinks 1.0.5 [ed. note: iusemodx last edited this post 11 years, 7 months ago.]
            • 49667
            • 59 Posts
            Hi,

            I think I did that... not sure.

            I created a template_variable with a drop-down-list. The drop-down-list has all the authors names.
            I then pick the authors name for each blogpost.

            I then use the above Ditto call with the &filter to publish only the blogposts written by one specific author. That all works. But in my above Ditto call, I have only one author name. So its not dynamically changing for all my author names uniquely and separately.

            Maybe I misunderstood or I did something completely different than what you mean??
              • 13226
              • 953 Posts
              Its late at night, but I think I understand

              The page you are displaying the posts on - is it cached ?

              Lets say you are on a post page and there is a link to the author page - is the author page bespoke or is it a landing page for all authors ?
                • 13226
                • 953 Posts
                My post page Tag call:
                [[Ditto? &documents=`[*id*]` &tagDocumentID=`10` &tagData=`myTags` &tpl=`dittotags` &tplTagLinks=`tplTagLinks` &tagSort=`1` &tagDelimiter=`,` &tagDisplayDelimiter=` `]]


                Tag document:
                [[Ditto? &parents=`1,2,3,4` &orderBy=`id DESC` &tagData=`myTags` &tagDelimiter=`,` &tagDisplayDelimiter=` ` &tpl=`Overview` &summarize=`10` &paginate=`1` &paginateAlwaysShowLinks=`1` &showInMenuOnly=`0` &showPublishedOnly=`1`]]
                
                <p>Viewing [+start+] - [+stop+] of [+total+] / [+currentPage+] of [+totalPages+]</p>
                
                <div class="dittopagination">
                [+previous+] [+pages+] [+next+]
                </div>


                Chunks:

                tplTagLinks
                <li><a href="[+url+]" rel="tag">[+tag+]</a></li>

                dittotags
                [+tagLinks+]

                Overview
                <div class="ditto_item" id="ditto_item_[+id+]">
                  <h3 class="ditto_pageTitle"><a href="[~[+id+]~]">[+pagetitle+]</a></h3>
                  <div class="ditto_introText">[+introtext+]</div>
                </div>
                [ed. note: iusemodx last edited this post 11 years, 7 months ago.]
                  • 13226
                  • 953 Posts
                  The above solution uses 1 bespoke page for all tags - a shared landing page.

                  The landing page (my example = 10) needs to be set as uncached / remove the tick from "Cacheable" in the page settings

                  You can also create a bespoke landing page on a per Author basis, whereby the set-up is different - I use both
                    • 13226
                    • 953 Posts
                    If you want to use bespoke pages for the individual authors / tags / categories etc. you can set up as shown below:

                    Part 1:

                    Create a parent - add all of your tags as single pages, using the tag as Pagetitle, longtitle etc.

                    I suggest creating a bespoke template for the single page / element / tag / category / author overview page

                    Add the following to the templates content area or if you are not using a bespoke template add it to each of the pages content area you have created:

                    [[Ditto?
                    &parents=`1,2,3,4`
                    &orderBy=`id DESC`
                    &tagData=`authors`
                    &tpl=`Overview`
                    &tagDelimiter=`,`
                    &summarize=`10`
                    &paginate=`1` 
                    &paginateAlwaysShowLinks=`1`
                    &showInMenuOnly=`0`
                    &showPublishedOnly=`1`
                    &hideFolders=`1`
                    &depth=`2` 
                    &tagMode=`onlyTags`
                    &tags=`[*pagetitle*]`
                    &noResults=`No Results Found For [*pagetitle*]`
                    ]]


                    The call uses new lines simply for readability (for this explanation) I suggest putting it all in one line when in use.

                    The "hidefolders" and "depth" need to be tested in your setup, they are not neccessarily needed, but i've left them as is.

                    You can see that the "tagdata" calls the main tag TV and the "tags" elements uses the pagetitle for the current page tag.

                    Part 2:

                    Now we need to setup the post page where the link to the authors post overview page needs to be added.

                    I suggest you use TagLinks to do this as it's simple to use and works well.

                    My post page outputs the tags using the following call:

                    [[tagLinks? &path=`[~17~]` &tv=`author` &delimiter=`,` &separator=``]]


                    The "path" is the parent folder where all of the individual author pages are kept.

                    NOTE: tagLinks can only use one tv, it's not like Ditto which can take multiple TVs.

                    That's it
                      • 13226
                      • 953 Posts
                      If you want to add related posts to the post page (not author overview), read this.