- Posts: 7
COMMUNITY FORUM
Cant' get introtext to work
- Dawn Mellowship
- Topic Author
- Offline
- New Member
Less
More
14 years 7 months ago #81680
by Dawn Mellowship
Cant' get introtext to work was created by Dawn Mellowship
Hi,
No matter what I do I can't get the introtext function to work. It's for sub-categories within a category. I set the introtext parameter within the category to show and set a word limit and in the sub-categories indicated that the parameters should be taken from the main category, but it doesn't work. I tried adding the introtext limit in the sub-categories too and in the items but they still don't work. Any ideas what else I can try. Introtext is also set to display in the main configuration parameters and everywhere else too. Thanks!
No matter what I do I can't get the introtext function to work. It's for sub-categories within a category. I set the introtext parameter within the category to show and set a word limit and in the sub-categories indicated that the parameters should be taken from the main category, but it doesn't work. I tried adding the introtext limit in the sub-categories too and in the items but they still don't work. Any ideas what else I can try. Introtext is also set to display in the main configuration parameters and everywhere else too. Thanks!
Please Log in or Create an account to join the conversation.
- Alan Sparkes
- Offline
- Premium Member
Less
More
- Posts: 118
14 years 6 months ago #81681
by Alan Sparkes
Replied by Alan Sparkes on topic Cant' get introtext to work
Had issues with this in the module when truncating ntros in items
The utilities function doesn't seem to work in the module - cant speak for sub cats :)
try editing this function 'wordLimit' in the file '/components/com_k2/helpers/utitlies.php':
change to this;
function wordLimit($str, $limit, $end_char = '…') {
if (trim($str) == '')
return $str;
if (strlen($str) > $limit) {
$str = strip_tags($str);
$str = substr($str, 0, $limit);
$end = strrpos($str, ' ');
if ($end === false) {
$end = $limit;
}
$string = substr($str, 0, $end) . '...';
}
return $string;
}
The utilities function doesn't seem to work in the module - cant speak for sub cats :)
try editing this function 'wordLimit' in the file '/components/com_k2/helpers/utitlies.php':
change to this;
function wordLimit($str, $limit, $end_char = '…') {
if (trim($str) == '')
return $str;
if (strlen($str) > $limit) {
$str = strip_tags($str);
$str = substr($str, 0, $limit);
$end = strrpos($str, ' ');
if ($end === false) {
$end = $limit;
}
$string = substr($str, 0, $end) . '...';
}
return $string;
}
Please Log in or Create an account to join the conversation.
- Chris Yates
- Offline
- Senior Member
Less
More
- Posts: 62
14 years 6 months ago #81682
by Chris Yates
Replied by Chris Yates on topic Cant' get introtext to work
One assumes you're not having a "blonde" moment and have forgotten to put a readmore between introtext and fulltext in the editor???
It only works if you add the readomore!
Be Well,
CHRIS
It only works if you add the readomore!
Be Well,
CHRIS
Please Log in or Create an account to join the conversation.
- Alan Sparkes
- Offline
- Premium Member
Less
More
- Posts: 118
14 years 6 months ago #81683
by Alan Sparkes
Replied by Alan Sparkes on topic Cant' get introtext to work
Totally blond - I guess the pregmatch
preg_match('/\s*(?:\S*\s*){'.(int) $limit.'}/', $str, $matches);
is looking for the read more system tag. Doh
Still its nice to have the truncation regardless when the design space is tight.
cheers Chris
Off to pharmacy/chemist to buy some black hair die.....
Chris Yates said:One assumes you're not having a "blonde" moment and have forgotten to put a readmore between introtext and fulltext in the editor???
It only works if you add the readomore!
Be Well,
CHRIS
preg_match('/\s*(?:\S*\s*){'.(int) $limit.'}/', $str, $matches);
is looking for the read more system tag. Doh
Still its nice to have the truncation regardless when the design space is tight.
cheers Chris
Off to pharmacy/chemist to buy some black hair die.....
Chris Yates said:One assumes you're not having a "blonde" moment and have forgotten to put a readmore between introtext and fulltext in the editor???
It only works if you add the readomore!
Be Well,
CHRIS
Please Log in or Create an account to join the conversation.