Vox Populi(x) forum

Alexandria Book Library => Supporto (Support) => Topic started by: matstar on 22 July 2015, 11:53:59

Title: The number of characters in the description of the authors list
Post by: matstar on 22 July 2015, 11:53:59
The number of characters in the description of the authors list
Hello!
Please tell me how I can change the list of authors, the number of characters or words. This feature is in the module settings, but not in the basic settings.
Thank you in advance for your reply!
Title: Re: The number of characters in the description of the authors list
Post by: federica on 24 July 2015, 10:56:21
Hi matstar,
you have to modify the file:
components/com_abook/views/authors/tmpl/default_items.php line 49
<div><?php echo substr(strip_tags($item->description), 0, 100);?></div>
to
<div><?php echo substr(strip_tags($item->description), 0, NUMBER_YOU_PREFER);?></div>
Title: Re: The number of characters in the description of the authors list
Post by: matstar on 27 July 2015, 15:44:10
Federica Hello!
Thanks for the answer. After I replaced the line that you have written, I have gone full description. I replaced this line number 100 3000 and Me was enough number of characters in the description.
It would be good if in future versions, you will be provided the opportunity to the component settings in the module settings: "Maximum description length".

P.S. I have all the translated files are components and modules in the Ukrainian language, if you are interested, I will gladly give you files with localization.
Title: Re: The number of characters in the description of the authors list
Post by: federica on 11 August 2015, 11:44:45
You are right! I will add the option you suggested in my todo list.

I published your translation http://alexandriabooklibrary.org/en/downloads/22-translations.html
Many thanks
Title: Re: The number of characters in the description of the authors list
Post by: le5 on 16 September 2015, 14:22:59
Hello Matstar

I changed this, since I wanted to have full words and not just 100 characters.
So I made a template override for this view and added following function a the top.

<?php

// no direct access
defined('_JEXEC') or die;

$listOrder $this->state->get('list.ordering');
$listDirn $this->state->get('list.direction');

function 
get_snippet$str$wordCount 10 ) {
return implode(
'',
array_slice(
preg_split(
'/([\s,\.;\?\!]+)/',
$str,
$wordCount*2+1,
PREG_SPLIT_DELIM_CAPTURE
),
0,
$wordCount*2-1
)
);
}


and changed the ouput where the description is shown to

<?php echo get_snippet(strip_tags($item->description),45) . ' ... ';?>

for display the first 45 words.
Title: Re: The number of characters in the description of the authors list
Post by: federica on 20 September 2015, 17:32:34
Hi le5,
thank you for your contribution