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!
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>
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.
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
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.
Hi le5,
thank you for your contribution