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

How to Limit the amount of Characters in 'Post By' Column:

Discussion in 'Styling and Customization Questions' started by CritiKiL, Apr 9, 2013.

  1. CritiKiL

    CritiKiL Active Member

    This code provides the ability to 'limit' the amount of characters in the 'Recent Posts' column and I would like to do the same for the 'Posted By' column:
    Code:
    <tr class="dataRow">
    <td><a href="{xen:link 'posts', $post}" class="Tooltip" title="{$post.title}">{xen:helper wordTrim,{$post.title}, 30}</a></td>
    <td><xen:username user="$post" rich="true" />
    <div class="userTitle">{xen:helper userTitle, 'username', $post}</div></td>
    <td><xen:datetime time="$post.post_date" class="muted" /></td>
    <td><a href="{xen:link 'forums', $post}">{$post.node_title}</a></td>
    </tr>
    I just need to know how to phrase it properly using the "wordTrim". Can anyone help? Thanks in Advance ;-)

    BTW: The reason is because on a mobile phones-view, a posters name that is larger than 10 characters stretches my set width.
     

    Attached Files:

  2. James

    James Well-Known Member

    {xen:helper wordTrim,{variableToTrim}, maxLength}

    {xen:helper wordTrim,{$post.author}, 10} is probably what you're looking for.

    If not author, probably username.
     
  3. CritiKiL

    CritiKiL Active Member

    Yea, neither of those ($post.author / $post.username) did the trick...
     
  4. James

    James Well-Known Member

    <div class="userTitle">{xen:helper userTitle, 'username', $post}</div></td>

    Replace with:
    <div class="userTitle">{xen:helper wordtrim, {xen:helper userTitle, 'username', $post}, 10}</div></td>

    That should work, though untested.
     
  5. CritiKiL

    CritiKiL Active Member

    Still nothing. Changed it to include your suggestion below:
    HTML:
    <tr class="dataRow">
    <td><a href="{xen:link 'posts', $post}" class="Tooltip" title="{$post.title}">{xen:helper wordTrim,{$post.title}, 30}</a></td>
    <td><xen:username user="$post" rich="true" />
    <div class="userTitle">{xen:helper wordtrim, {xen:helper userTitle, 'username', $post}, 10}</div></td>
    <td><xen:datetime time="$post.post_date" class="muted" /></td>
    <td><a href="{xen:link 'forums', $post}">{$post.node_title}</a></td>
    </tr>
    That's why I made a thread because it looks simple, but somethings not giving ;-(
     
  6. James

    James Well-Known Member

    I've only just looked at the screenshots (stupidly), is that an add-on you're using?
     
    CritiKiL likes this.
  7. CritiKiL

    CritiKiL Active Member

    Yes, it's an addon but the creator does not provide support and there's nothing wrong as it was not intended to be perfectly 'mobile-functional', so I'm trying to tweak it because our community views mostly from our smartphones and tablets.
     

Share This Page