domstang

Topic: Limit characters of post title

Hello

On the home page->Most recent job
I'd like to limit the number of characters

For example:
Before: This title is really really too long
Result: This title is really...

Thanks very much for your help
(Sorry for my English)

Offres d'emploi restauration : http://www.emploi-restaurant.fr

links

Re: Limit characters of post title

Hi,

You can do this if you go in home.tpl at line 34 (or somewhere arround there smile ), where you have:

Code:

{foreach item=job from=$latest_jobs}
<tr>
    <td>
    {if $job.type_id == $smarty.const.JOBTYPE_FULLTIME}
    <img src="{$BASE_URL}img/icon-fulltime.png" alt="full-time" />
    {elseif $job.type_id == $smarty.const.JOBTYPE_PARTTIME}
    <img src="{$BASE_URL}img/icon-parttime.png" alt="part-time" />
    {elseif $job.type_id == $smarty.const.JOBTYPE_FREELANCE}
    <img src="{$BASE_URL}img/icon-freelance.png" alt="freelance" />
    {/if}
    <a href="{$BASE_URL}job/{$job.id}/{$job.url_title}/" title="{$job.title}">{$job.title}</a> <span class="la">{$translations.homepage.at}</span> {$job.company}{if $job.location == 'Anywhere'}, {$job.location}{else} <span class="la">{$translations.homepage.in}</span> {$job.location}{/if}
    </td>
    <td class="time-posted"><img src="{$BASE_URL}img/clock.gif" alt="" /> {$job.created_on}</td>
</tr>
{/foreach}

Instead of:

Code:

 <a href="{$BASE_URL}job/{$job.id}/{$job.url_title}/" title="{$job.title}">{$job.title}</a>  

You should have

Code:

 <a href="{$BASE_URL}job/{$job.id}/{$job.url_title}/" title="{$job.title}">{$job.title|truncate:20}</a>  

if the 20's character is inside a word, the entire word will be shown, though.

I hope it's what you wanted.

Bonne chance! smile

domstang

Re: Limit characters of post title

THANK YOU VERY MUCH !!!!
It's exactly what i wanted.

Offres d'emploi restauration : http://www.emploi-restaurant.fr