{ Don't Repeat Yourself ! }

Browsing Posts published in August, 2013

Just came across a strange behavior in Joomla 3 and component routing.
Found out that the first hypen in a SEF URL is always replaced by a colon.

Joomla assumes all SEF URLs have a structure like this: http://yoursefurl/mymenu/1­-welcome­-to­-joomla
The last part is called the slug and this seems to get messed up if you have hyphens in you url and the first part is not an ID.

The Joomla router will translate the slug segment into 1­:welcome­-to­-joomla, replacing the first hypen with a colon to separate the ID.

You either need to adjust your router and include first an id in your url followed by a hyphen or add

$vars['myitem'] = str_replace(“:”, “-” , $segment[1] ) ;

in your router.

I recently upgraded from Kunena 1.5 to Kunena 3

In Kunena 3 the ID in the SEF URL refers to the topic ID rather then message ID.
This is better for SEO, but old messages links from before the update are not working anymore unless they are the first message in a thread.

By inserting this bit of code into the components/com_kunena/router.php
after line 223 you can replace the message ID with topic ID, if the url contains a message ID rather then topic ID
That makes sure that your old Kunena URL’s still work after the update.


$db = JFactory::getDBO() ;

$sql = ‘select * from #__kunena_topics where id = ‘ . intval( $value ) . ‘ limit 1′ ;
$db->setQuery($sql ) ;
$r = $db->loadObject() ;

if(!$r) {
$sql = ‘select * from #__kunena_messages where id = ‘ .intval( $value ) . ‘ limit 1′ ;
$db->setQuery($sql ) ;
$r = $db->loadObject() ;
if($r) {
$value = $r->thread ;
$vars ['mesid'] = $r->id ;


locate the following bit of code in the router.php file – should be at line 223 and insert the above code just after $sefcats = false;

elseif (empty($vars ['id'])) {
// Second number is always topic
$var = 'id';
$vars ['view'] = 'topic';
$sefcats = false;

Install a linux distro via USB:  makes it easy to create a bootable usb to install various linux distros

I decided to install debian onto a 32GB usb stick. So first I created a debian netinstall with unetbootin on an old 2GB usb stick, that I had lying around.
I booted from this stick and then plugged my empty 32GB stick into the second USB slot. During the debian installation I choose to have it partition and format the 32GB stick and use it for installation of the base system. Then I had grub installed onto the main hard drive. That works pretty good. I can now fully run debian from usb and disable the hard drive to save power.

A few handy commands:

- vbetool dpms {off/on} – turn display off or on
- pm-suspend – standby

I also installed laptop-mode-tools for power saving.
And then of course apache2, php5, mysql


Get Adobe Flash player