[geeklog-devel] Pop-up topic listing code...
Rob Griffiths
robg at macosxhints.com
Thu Feb 6 12:59:31 EST 2003
For the longest time, I've been conserving veritcal real estate with a
horizontal topic bar in lieu of the section block ... but I got tired of
it, and decided to create a pop-up topic list for inclusion in the side
panel. You can see the results (on a somewhat irregular basis as the
machine comes and goes from the net) at http://griffman.homeip.net:5080
(login guest, pword guestuser). The code uses one line of Javascript to
execute on selection instead of waiting for the submit button to be
pressed (though that's present as well, just in case).
I added the following very simple function to lib-custom.php:
function phpblock_showtopics($topic='') {
global $_CONF, $topic;
$retval = '<div align="center"><br>';
$retval .= '<form action="index.php" method="get">';
$retval .= "<select name=\"topic\"
onchange=\"window.location=('/index.php?topic='+this.options[this.select
edIndex].value)\">";
$retval .= "<option value=\"\">-- All Topics --</option>";
$retval .= COM_topicList('tid,topic',$topic);
$retval .= '</select> <input type="submit"
value="Go!"></form></div>';
return $retval;
}
Then add a new PHP block with phpblock_showtopics as its name, and
you're done. Seems to work pretty well, though I think I need to add the
site URL variable instead of hard coding the /index just in case (but it
was a rush job last night).
-rob.
More information about the geeklog-devel
mailing list