Keyword

Latest articles - Title character limit

More
5 years 7 months ago #126016 by Sani
Sani created the topic: Latest articles - Title character limit
Hi,

i know that these lines are for module title:
<?php if($params->get('itemImage') && isset($item->image)): ?>
					<a class="moduleItemImage pull-left" href="<?php echo $item->link; ?>" title="<?php echo JText::_('K2_CONTINUE_READING'); ?> &quot;<?php echo K2HelperUtilities::cleanHtml($item->title); ?>&quot;">
						<img src="<?php echo $item->image; ?>" alt="<?php echo K2HelperUtilities::cleanHtml($item->title); ?>"/>
					</a>
			<?php endif; ?>

I found a solution for default joomla module, not k2, but i think it is similiar principle. How to modify it so that i can limit the character number that displays news titles in the module?
<?php echo (strlen($article->title) > 25 ? substr($article->title,0,25).'...' : $article->title); ?>

Please Log in or Create an account to join the conversation.

More
5 years 7 months ago #126017 by Lefteris
Lefteris replied the topic: Re: Latest articles - Title character limit
Hi. You can do it the exact same way. Just replace :
$article->title

with :
$item->title

In your override of mod_k2_content.

IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

---
JoomlaWorks
www.joomlaworks.net/

Please Log in or Create an account to join the conversation.

Moderators: william white

Powered by Kunena Forum