roktabs  I 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
if ($tabs == 0) $tabs = count($list);
for($i = 0; $i < $tabs; $i++) {
if ($list[$i]->title != '' && $list[$i]->introtext != '') {<br />echo "<div class='roktabs-tab".($i+1)."'>\n";<br />echo "  <div class='wrapper'>\n";<br />echo    $list[$i]->introtext;<br />echo "  </div>";<br />echo "</div>\n";<br />}<br />}<br /> <br />?></code></p> <p>To just add the readmore link, change to this:</p> <div class="codeholder"></div> <div class="codeholder"></div> <div class="codeholder"></div> <div class="codeholder"><code><?php<br />if ($tabs == 0) $tabs = count($list);<br />for($i = 0; $i < $tabs; $i++) {<br />if ($list[$i]->title != '' && $list[$i]->introtext != '') {<br />echo "<div class='roktabs-tab".($i+1)."'>\n";<br />echo "<div class='wrapper'>\n";<br />echo "<br />";<br />echo   $list[$i]->introtext;<br />echo "  <p class='readon' style='float:right'>";<br />echo "  <a href='".$list[$i]->link."'><span>Read More...</span></a>";<br />echo "  </p>";<br />echo "  </div>";<br />echo "</div>\n";<br />}<br />}<br /> <br />?></code></div> <div class="codeholder"></div> <div class="codeholder"></div> <div class="codeholder"> <div class="text" id="cb50853"> <div class="li1"> <div class="codeholder"> <div class="text" id="cb50853"></div> <p>To add the readmore link and a title linked to the article, change to this:</p> <div class="text"><code><?php<br />if ($tabs == 0) $tabs = count($list);<br />for($i = 0; $i < $tabs; $i++) {<br />if ($list[$i]->title != '' && $list[$i]->introtext != '') {<br />echo "<div class='roktabs-tab".($i+1)."'>\n";<br />echo "<div class='wrapper'>\n";<br />echo "<h4>";<br />echo "<a href='".$list[$i]->link."'>";<br />echo $list[$i]->title;<br />echo "</a>";<br />echo "</h4>";<br />echo "<br />";<br />echo   $list[$i]->introtext;<br />echo "  <p class='readon' style='float:right'>";<br />echo "  <a href='".$list[$i]->link."'><span>Read More...</span></a>";<br />echo "  </p>";<br />echo "  </div>";<br />echo "</div>\n";<br />}<br />}<br /> <br />?></code></div> <div class="text"></div> <div class="text" id="cb50853"> <div class="li1"></div> <div class="li1"></div> <div class="li1"></div> <div class="li1"> <div class="codeholder"> <div class="text" id="cb23216"> <div class="li1"></div> <div class="li1"></div> <div class="li1"></div> <div class="li1">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.....</div> <div class="module-title"> <div class="module-title2"> <div class="module-title3"> <h2 class="rt-pagetitle">To auto limit the text in each roktabs slide</h2> </div> </div> </div> <p>Locate the file /modules/mod_roktabs/helper.php around line 165</p> <p><code>$text = JHTML::_('content.prepare',$row->introtext,$contentConfig);</code></p> <div class="text" id="cb23216">And replace it with:</div> <div class="text"></div> <div class="text"><code>$message=JHTML::_('content.prepare',$row->introtext,$contentConfig);<br />$post=200; // Define how many characters you want to display.<br />$text = substr($message,0,$post);</code></div> <div class="text"></div> <div class="codeholder"> <div class="text" id="cb40326">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: <div class="li1"></div> <div class="li1"></div> <div class="li1"><code>echo $list[$i]->introtext;<br />echo "...";<br />echo "<p class='readon' style='float:right'>";</code></div> <div class="li1"></div> <div class="li1"></div> </div> <div class="text" id="cb40326">Now you should have a nice looking scrolling/fading tabbed/not tabbed news box!</div> <div class="text"></div> <div class="text">Temporary example is here:</div> <div class="text"></div> <a href="http://www.biteconsulting.com">http://www.biteconsulting.com </a></div> <p> </p> </div> </div> </div> </div> </div> </div> </div> </div>'

Category: Joomla

Newsletter Signup

Latest Posts

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
Pagespeed Addon for Firefox 7 (and enable all your incompatible addons!) Pagespeed Addon for Firefox 7 (and enable all your incompatible addons!) 2011-09-20 - If you have the beta test version of firefox then it can be quite annoying when you u... More detail
Enable KeepAlive on Godaddy VPS Enable KeepAlive on Godaddy VPS 2011-09-19 - Another red warning light when running google page speed or yslow that is quite easy ... More detail

Twitter Stuff