1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.3 Conversation List Item

Discussion in 'Styling and Customization Questions' started by Amaury, Aug 21, 2014.

  1. Amaury

    Amaury Well-Known Member

    I've been changing a lot of templates containing "datetime" and changing the comma separator to a vertical pipe separator between the username and date stamp or what have you as well as calling phrases in the templates (e.g., posted_by and posted). However, I am having trouble with the template for the conversation list.

    This is how it currently is:

    I want there to be a vertical pipe between the usernames and date stamp, so if I change this:

    <xen:if is="{$recipient.user_id} != {$conversation.user_id}"><xen:username user="$recipient">{xen:if $recipient.user_id, $recipient.username, {xen:phrase unknown_member}}</xen:username>,</xen:if>
    To this:

    <xen:if is="{$recipient.user_id} != {$conversation.user_id}"><xen:username user="$recipient">{xen:if $recipient.user_id, $recipient.username, {xen:phrase unknown_member}}</xen:username> |</xen:if>
    It works, but the problem is when there are three or more conversation participants, it displays like this:

    Convo Display.png

    There should be a comma after my name, not a vertical pipe.

    Any help?
  2. Arty

    Arty Well-Known Member

    Its a loop iterating all users, so you need to change it to use comma if there are more loop entries and pipe if its last loop entry:
              <xen:foreach loop="$conversation.recipientNames" value="$recipient" i="$i" count="$total">
                 <xen:if is="{$recipient.user_id} != {$conversation.user_id}"><xen:username user="$recipient">{xen:if $recipient.user_id, $recipient.username, {xen:phrase unknown_member}}</xen:username><xen:if is="{$i} == {$total}">|<xen:else />,</xen:if></xen:if>
    Amaury likes this.
  3. Amaury

    Amaury Well-Known Member

    So just change what I have to the above or do I add the above as a separate line of code?
  4. Arty

    Arty Well-Known Member

    Change your existing code
    Amaury likes this.

Share This Page