Fixed nodeLastPost - ellipsis shortening not working. Solution.


Well-known member
There is a code that trims text in the last post link. Here it is:

{xen:helper wordTrim, $forum.lastPost.title, 30}

Unfortunately it doesn't work with cyrilic symbols.

Here is a solution how to make it work:

In template 'node_forum_level_2' find the <div class="nodeLastPost secondaryContent"> block.

After the opening tag we should create another block and call it for example .lastPostLinkWrap and place there all code that corresponds to the last post link. Then we should remove the wordTrim function from there. The result should look like this:

        <div class="nodeLastPost secondaryContent">
            <xen:if is="{$forum.privateInfo}">
                <span class="noMessages muted">({xen:phrase private})</span>
            <xen:elseif is="{$}" />
                <div class="lastPostLinkWrap">
                    {xen:phrase latest}: <a href="{xen:link posts, $forum.lastPost}" title="{$forum.lastPost.title}">$forum.lastPost.title</a>
                <span class="lastThreadMeta"><xen:if is="{xen:helper isIgnored, $forum.last_post_user_id}">{xen:phrase ignored_member}<xen:else /><xen:username user="$forum.lastPost" /></xen:if>, <xen:datetime time="$" class="muted" /></span>
            <xen:else />
                <span class="noMessages muted">({xen:phrase contains_no_messages})</span>

And in node_list.css we should add the following:

.nodeLastPost .lastPostLinkWrap
    display: inline-block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: {xen:calc '@nodeLastPost.width - (@nodeLastPost.padding-left + @nodeLastPost.padding-right)'}px;

The result is pretty awesome:



Well-known member
Update: trim works with cyrilic characters but it does trim too late. The phrase 'Latest' is a bit longer when translated to russian, so we will need to change the characters count in the wordTrim function. This is a bit of a hack, so my pure CSS soultion works better. It doesn't need any fine tuning for custom languages + suits most of the styles. (and yes is does cut the text in the right place because it considers paddings.). And of course it also shows the full text if we hover the link.