Author Topic: Add the "About me" field to search results showing limited characters  (Read 1389 times)

adigoldman

  • Confirmed Member
  • **
  • Posts: 6
  • Karma: +0/-0
Hi,

I added the field 'About me' to the users search results, by adding
<p class="info"><span>{profile.f5_label}</span>: {profile.f5}</p>
to the result_user.html.
How can we adjust amount of text to shown? and not all the 'About me' description, let say show only the 100 first characters of the description.
Is there any easy way to do that?

Thanks.

maverick

  • Administrator
  • Veteran Member
  • *****
  • Posts: 2878
  • Karma: +210/-7
    • Maverick Webworks
Re: Add the "About me" field to search results
« Reply #1 on: May 02, 2014, 12:08:25 PM »
This can be accomplished by using a jQuery plugin script for truncating text.


First go to: https://code.google.com/p/toolong/downloads/list
and download the TooLong_jQuery_1.0.zip file.

Open the zip file and look for the "toolong.jquery.min.js" file and upload this to your Etano "js" folder.


Then open your skins_site/def/static/search_results.html file and add the following line into the list of profile fields to be displayed:
Code: [Select]
<p class="info text"><span>{profile.f5_label}</span>: {profile.f5}</p> After editing this file, in order for the changes to take effect you must regenerate your skin in the Admin >> Site Setup >> Skin Settings >> and then click regenerate under your default skin.


Then open your skins_site/def/search.html file and add the following:
Code: [Select]
<script type="text/javascript" src="{tplvars.relative_url}js/toolong.jquery.min.js"></script>

<script type="text/javascript">
$(document).ready(function() {
$('.text').TooLong({ 'len' : 100 });
});
</script>


It should be placed directly above the following javascript code that already exists in the file:
Code: [Select]
<script type="text/javascript">
var search_md5='{output.search_md5}';
var lang=[];
lang['253']='{output.lang_253}';
lang['254']='{output.lang_254}';
</script>

Fusion Responsive Template & Free Mods
http://www.maverickwebworks.com
DO NOT PM me asking for personal help. Post your problem or request in the forums so the entire community can contribute and benefit.

adigoldman

  • Confirmed Member
  • **
  • Posts: 6
  • Karma: +0/-0
Re: Add the "About me" field to search results
« Reply #2 on: May 02, 2014, 12:53:43 PM »
Excellent, working like a charm. Thank you very much Maverick.