We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28203
    • 26 Posts
    After a lot of experimenting and searching through this forum I solved a little, but important(at least to me) feature for the MODx BLOG.
    I’m quite new to MODx, and all I do is just asking at these forums, so finally I think its time to make a humble contribution with this guide, enjoy smiley

    How to Display the Author (Full Name) and Published Date below the title(or wherever you want) on your single post page.

    Requirements:
    1. http://modxcms.com/PHx-1006.html"" target="_blank" rel="nofollow">Download the PHx Plugin and install it according to its instructions
    2. http://modxcms.com/AuthorTimestamp-1.2-0.html"" target="_blank" rel="nofollow">Download the AuthorTimestamp Snippet and again install it according to its manual
    3. And UltimateParent Snippet 2.0 beta which is already included in the newest version of MODx, but if for any reason you don’t have it installed you can find it in quotes http://modxcms.com/forums/index.php/topic,1290.msg140067.html#msg140067"" target="_blank" rel="nofollow">here (you have to delete a few lines at the end in order to function.

    Here is the guide:

    1. Create a new Template Variable with a name authortimepost, and put this inside (Default Value:) :

    - Insert this if you have a simple blog without categories:

    [+phx:if=`[[UltimateParent]]`:is=`2`:and:isnot=`[*id*]`:then=`[[AuthorTime]]`:else=``+]

    *where the number 2 is the ID of your Parent Blog Document where all of your documents are contained.


    - Insert this if you have your single post documents in Document Containers as categories:

    [+phx:if=`[[UltimateParent]]`:is=`48`:and:isnot=`[*id*]`:and:if=`[[UltimateParent? &topLevel=`2`]]`:is=`11`:and:isnot=`[*id*]`:or:if=`[[UltimateParent? &topLevel=`2`]]`:is=`22`:and:isnot=`[*id*]`:or:if=`[[UltimateParent? &topLevel=`2`]]`:is=`33`:and:isnot=`[*id*]`:then=`[[AuthorTime]]`:else=``+]

    *2 - ID of the Blog Parent Document
    11 - ID of the First Category
    22 - ID of the Second Category
    33 - ID of the Third Category

    If you want to add one more category, simply add this code:

    :or:if=`[[UltimateParent? &topLevel=`2`]]`:is=`44`:and:isnot=`[*id*]`

    right next to this code:

    :or:if=`[[UltimateParent? &topLevel=`2`]]`:is=`33`:and:isnot=`[*id*]`

    (And Don’t forget to assign the Template Variable to the template you use)

    2. Edit your template and call out the authortimepost Template Variable you’ve just created right below the title. Search for:

    <h2>[*longtitle*]</h2>
    [*#content*] </div>

    and insert your Template Variable [*authortimepost*] between the two like this:

    <h2>[*longtitle*]</h2>
    [*authortimepost*]
    [*#content*] </div>

    3. Make sure you check out the Cacheable to every document where you want the date/author to appear, because otherwise it won’t show, at least that was the case for me.

    And that should be it.
      • 6726
      • 7,075 Posts
      Nice thanks for the tuto smiley

      Note that you can also use the userinfo PHx filter instead of AuthorTimeStamp (e.g [tt][*createdby:userinfo=`fullname`*][/tt] ) and the date filter for the published date, e.g [tt][*pub_date:date=`%d %B %Y`*][/tt]
        .: COO - Commerce Guys - Community Driven Innovation :.


        MODx est l&#39;outil id
        • 28203
        • 26 Posts
        Quote from: davidm at Apr 28, 2008, 03:37 PM

        Nice thanks for the tuto smiley

        Note that you can also use the userinfo PHx filter instead of AuthorTimeStamp (e.g [tt][*createdby:userinfo=`fullname`*][/tt] ) and the date filter for the published date, e.g [tt][*pub_date:date=`%d %B %Y`*][/tt]

        Hey thats exactly what I was looking for, I knew there must be such a tag in PHx to call out the full name, but I didn’t know how it’s called.

        I scrolled the PHx wiki page all day long and couldn’t figure that out, so thats why I used AuthorTimestamp.

        I will try it out your way now, thanks! smiley
          • 6726
          • 7,075 Posts
          There are always many ways to achieve things in MODx smiley

          This being said I am not sure this will work inside a PHx call (never tried it I think the PHx parser is recursive but not sure), so your way might still be the way to go when you have conditionnals...
            .: COO - Commerce Guys - Community Driven Innovation :.


            MODx est l&#39;outil id