The number of characters in the description of the authors list

Started by matstar, 22 July 2015, 11:53:59

Previous topic - Next topic
A financial contribution is greatly appreciated as a support, to help us to keep live the project.
If you like this project you can donate some piece of BitCoin to this address: bc1qy5tgq6tvrckac2a57unxvqcnxamrvhduve9sj9

matstar

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!

A financial contribution is greatly appreciated as a support, to help us to keep live the project.
If you like this project you can donate some piece of BitCoin to this address: bc1qy5tgq6tvrckac2a57unxvqcnxamrvhduve9sj9

federica

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>
Al mondo ci sono 10 tipi di persone, quelli che hanno capito il codice binario e quelli che non l'hanno capito.
Informatizzati [url="https://informatizzati.org"]https://informatizzati.org[/url]
Stacca la spina [url="https://disconnessi.org"]https://disconnessi.org[/url]

matstar

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.

federica

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
Al mondo ci sono 10 tipi di persone, quelli che hanno capito il codice binario e quelli che non l'hanno capito.
Informatizzati [url="https://informatizzati.org"]https://informatizzati.org[/url]
Stacca la spina [url="https://disconnessi.org"]https://disconnessi.org[/url]

A financial contribution is greatly appreciated as a support, to help us to keep live the project.
If you like this project you can donate some piece of BitCoin to this address: bc1qy5tgq6tvrckac2a57unxvqcnxamrvhduve9sj9

le5

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.

federica

Al mondo ci sono 10 tipi di persone, quelli che hanno capito il codice binario e quelli che non l'hanno capito.
Informatizzati [url="https://informatizzati.org"]https://informatizzati.org[/url]
Stacca la spina [url="https://disconnessi.org"]https://disconnessi.org[/url]