Home Joomla 1.5 Web Development Tutorials Limit frontpage and blog layout intro text
Limit frontpage and blog layout intro text
User Rating: / 2
PoorBest 
Joomla 1.5 Web Development - Tutorials

Question: The default Joomla frontpage and blog layouts are nice. But, if the user forgets to add the read more break, the whole article shows up. So, we want to limit the intro text of the front page to 100 characters and the blog layouts to 300. 

Answer:

1) open: \components\com_content\views\frontpage\tmpl\default_item.php
Around line 119 find:

<?php echo $this->item->text; ?>

Replace with:

<?php
$limit =100;
if (strlen($this->item->text) > $limit) {
echo (substr($this->item->text, 0, $limit)) . " ... ";
}
else {
echo $this->item->text;
}
?>

What this does is limit the intro text to 100 characters.  For the blog layouts open \components\com_content\views\category\tmpl\blog_item.php and do the same, but change the value of 100 to 350.  This will show 350 characters vs 100.

 


Request Services
 
First Name
Last Name
E-mail
Phone
Domain
Service needed
Budget
  
Watch video overview


+ Suggested tags