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

    We have a template that will display an author’s article, and then any additional articles by that author.

    <div class="author">
    <h2>About the Author</h2>
    <img src="[!GetField?&docid=`[*author_profile_id*]`&field=`author_image`!]" style="width:90px; float:left"/>
    <p>[!GetField?&docid=`[*author_profile_id*]`&field=`content`!]</p>
    <h4>Other Articles by [!GetField?&docid=`[*author_profile_id*]`&field=`pagetitle`!]:</h4>
    <ul>[!Ditto?&display=`all`&tpl=`category_li`&filter=`author_profile_id,[*author_profile_id*],7`!]
    </div><!--author-->
    {{sidebar_right}}
    </div>


    What our client would like is that if there are no other articles, we don’t even display the text "Other Articles by author: No documents found."

    http://captainscruffy.com/career/secrets-of-happy-prosperous-self-employment.html

    How can I modify the above template code to achieve this?

    Thanks, - Dave
      • 7455
      • 2,204 Posts
      create a &tplFirst=`first_category_li` for ditto and put the "Other Articles by author:" in there plus the same as you have in your category_li chunk
      then use the &noResults=` ` (with space) in the ditto call and I think that you get the result you want.

      Dimmy
        follow me on twitter: @dimmy01
        • 16658
        • 11 Posts
        Thanks for your reply. Since I am such a beginner at this, I have to ask what is probably going to be a very easy question. Regarding

        > create a &tplFirst=`first_category_li` for ditto

        What does that mean?

        - Dave
          • 7455
          • 2,204 Posts
          now you have a chunk thats called category_li, right?
          now create a duplicate of that chunk and add the title part to the top, the part that say’s: <h4>Other Articles by [!GetField?&docid=`[*author_profile_id*]`&field=`pagetitle`!]:</h4>

          call that chunk first_category_li then add the above parameter to the ditto call: &tplFirst=`first_category_li`
          your call will be like this:
          [!Ditto?&display=`all`&tpl=`category_li`&tplFirst=`first_category_li` &filter=`author_profile_id,[*author_profile_id*],7`!]

          thats it
          now ditto wil take the first_category_li chunk to display the first item found and use the category_li chunk for the rest

          Dimmy
            follow me on twitter: @dimmy01