How to hide rows in a html table the right and easy way

I came into this problem a few days ago, and tried to search Google for “JavaScript hide table rows”, what came up was abysmal to say the least. Many iterated entire DOM trees using class names for each row to toggle. Some used reg exp in class/id names.

The solution came to me when thinking “isn’t there something called row-groups”. A swift visit to w3c and it was done in 2 minutes!

The nitty-gritty:

This requires prototype, but is easily adjusted for any “ExplandorCollapse” JavaScript function.

Give table tags with ids for each group, then hide/show that id.

It so simple you wish you had thought about it yourself!

Test it here




<th colspan="3" onmousedown="$('group1').toggle();">Group 1</th>



<tbody id="group1">

<tr><td>row1 col1 </td><td>row1 col2 </td><td>row1 col2 </td></tr>

<tr><td>row 2 col1 </td><td>row 2 col2 </td><td>row 2 col3 </td></tr>



<tr><th onmousedown="$('group2').toggle();">Group 2</th></tr>


<tbody id="group2">

<tr><td>col1 </td><td>col2 </td><td>row 1 col3 </td></tr>

<tr><td>row 2 col1 </td><td>row 2 col2 </td><td>row 2 col3 </td></tr>



Submitted by Olav Bringedal

How to make wikified links in php

If you are using output buffering, it’s pretty simple. Add this code at the bottom. It will parse text that are marked with [[..]] and transform it inot a link to the selected wiki page. so a text like [[wiki]] will transform into

$contents = ob_get_contents();      


ob_clean ( );      

$pattern = '/\[\[(([^\]]*?))\]\]/';      

// $pattern = "/&lt;&lt;(.*)&gt;&gt;/is";     

$contents = preg_replace($pattern, "</a><a href="%5C%22$yourwikipage/$1%5C%22" target="wiki">$1</a>", $contents);     

print ($contents);       

ob_end_flush(); presents The Five Pillars!

The Five Pillars is a brand new multiplayer online game set in a fresh and innovative fantasy/sci-fi setting, in which you compete to dominate this strange, post-apocalyptic world, together with hundreds of other players.

As the ruler of a great nation you have many options to rise to victory at your disposal, like assembling great armies from your populace, or calling for them by way of either of the 5 magical energies which are at your disposal. You can build your country into greatness peacefully, or warring for neighbouring player’s land continuosly and with no remorse. You can even have your guild build the most fabulous wonders of all times. Be the cruel warlord that has no life off of the battlefield or the subtle mage, pondering away in his room, casting vile enchantments at his enemies, or be the sly manipulating diplomatic scoundrel and make other people fight your fights.

The Five Pillars is a game programmed in php/mysql and are running on an apache Web Server. The development started late in year 2000 as a project to increas my skills in Linux/Apache/php/MySql (LAMP). When I quit my job in 2002 to be a freelance consultant, the development paced up and are now released in release candidate version.