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

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.
 

Attachments

  • IMG_0927[1].webp
    IMG_0927[1].webp
    35.8 KB · Views: 11
  • IMG_0926[1].webp
    IMG_0926[1].webp
    50.1 KB · Views: 11
{xen:helper wordTrim,{variableToTrim}, maxLength}

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

If not author, probably username.
 
<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.
 
<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.
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 ;-(
 
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.
 
Back
Top Bottom