roktabsI was looking for a simple latest news slider module for joomla 1.5. You would think that there are hundreds of them around but nothing really fitted what I needed and anything that did was using jquery which conflicted with the ajax search and twitter modules. Plus I don't really want to be loading 2 full java libraries.

I always liked the effects of the roktabs slider and rockettheme extensions are normally very high quality and good looking, but it didn't quite fit the bill.

 

The first problem was that, although you can set the width of each slide, the height auto expanded to fit the text of the article.

This might be ok if you remember to put in a readmore link into every article, but when you forget all the slides will be the size of the largest article.

The other problem is that roktabs doesn't actually add a readmore link.

So, I guess it wasn't the ideal choice for this purpose, but it looks nice and it uses mootools!

So........

To add a readmore link to each roktabs slide

In modules/mod_roktabs/tmpl/default.php locate these lines around line 81

?php
i ($tabs == 0) $tabs = count($list);
for($i = 0; $i < $tabs; $i++) {
if ($list[$i]->title != '' && $list[$i]->introtext != '') {
echo "\n";
echo " \n";
echo $list[$i]->introtext;
echo "  ";
echo "\n";
}
}
 ?>

To just add the readmore link, change to this:

?php
if $tabs == 0) $tabs = count($list);
for($i = 0; $i < $tabs; $i++) {
if ($list[$i]->title != '' && $list[$i]->introtext != '') {echo "\n";
echo "\n";
echo "";
echo   $list[$i]->introtext;
echo " 
";
echo "  <a href="/".$list[$i]->link."">Read More...</a>";
echo "  ";
echo "  ";
echo "\n";
}
} 
?>

To add the readmore link and a title linked to the article, change to this:

?php
i ($tabs == 0) $tabs = count($list);
for($i = 0; $i  $tabs; $i++) 
if ($list[$i]->title != '' && $list[$i]->introtext != '') {
echo "\n";
echo "\n";
echo "<h4>";
echo "<a href="/".$list[$i]->link."">";
echo $list[$i]->title;
echo "</a>";
echo "</h4>";
echo "
";
echo   $list[$i]->introtext;
echo "  
";
echo "  <a href="/".$list[$i]->link."">Read More...</a>";
echo "  ";
echo "  ";
echo "\n";
}
}
 
?>
This solves the link problem, but I also wanted the container to stay a fixed height with an automatic amount of text it the slide. sooo.....

To auto limit the text in each roktabs slide

Locate the file /modules/mod_roktabs/helper.php around line 165

$text = JHTML::_('content.prepare',$row->introtext,$contentConfig);

replace it with:

$message=JHTML::_('content.prepare',$row->introtext,$contentConfig);
$post=200; // Define how many characters you want to display.
$text = substr($message,0,$post);
Changing the 200 value to the number of characters you want to display. You might also want to change the default.php file to add a few ...'s to the end of the text like so:
echo $list[$i]->introtext;
echo "...";
echo "
";
Now you should have a nice looking scrolling/fading tabbed/not tabbed news box!
Temporary example is here:
http://www.biteconsulting.com 
Category: Joomla

Newsletter Signup

Latest Posts

Google+ Timeline Feed for your Website Google+ Timeline Feed for your Website 2012-05-11 - I was asked earlier today to create a Google+ widget for a website to replace a twitt... More detail
Run Facebook Messenger on Windows Vista Run Facebook Messenger on Windows Vista 2012-04-19 - Facebook has just released it's new messenger for windows but it only runs on Windo... More detail
Translate K2store Product Attributes with Joomfish Translate K2store Product Attributes with Joomfish 2011-11-03 - If you have a K2store and your site is in multiple languages, you might have found th... More detail
French Translations for K2store French Translations for K2store 2011-11-02 - I have been working recently with the K2 component/plugin K2store. As a simple sho... More detail
How I Upgraded to Joomla 1.7 How I Upgraded to Joomla 1.7 2011-09-25 - Inspired by Robert Vining over at www.joomstew.com and the fact that I am building mo... More detail

Twitter Stuff