Gossamer Forum
Home : Products : Links 2.0 : Customization :

Converting Default Links To A Pulldown?

Quote Reply
Converting Default Links To A Pulldown?
I've been messing around with the wonderful Links 2.0 script, and was wondering if there was any way to change the category menu page format.

As I'm sure you all know, it currently lists the links with the descriptions under it on the main index page in 2 columns (default).

This is good, but I'd like to have all the links to all my categories in a simple pulldown list. No descriptions, or any of the other default stuff. Just the list of links in a pulldown menu. I've got lots of them, and think everything in a list would be a lot easier.

Now I've messed around with the code in the sub site_html_print_cat section of the site_html_templates.pl file, which I noticed has a standard table code for what seems to be the 2 column category default list. I tried changing it to the CGI/pulldown form code, but it was a no go and just crashed the script.

The way I'm trying to do it, is add the regular pulldown form code (beginning and end) to the home.html file with the Links 2.0 Category tag in the middle, like so...

<FORM METHOD=POST ACTION="/cgi-bin/go.cgi">
<SELECT NAME="url" size=1>

<%category%>

</select>
<INPUT TYPE=submit VALUE="GO">
</FORM>

What I'm trying to get the script to do, is create the:

<option value="<%URL%>">-- <%Name%>

part of the code, that inserts all the links to the category pages between the form HTML already on the home.html template, which will complete the pulldown list when pages are built.

I hope that made sense. So, has anyone done this, or know what to change in the script to make it work right? I'd be very grateful if someone would share their knowledge, since I'm not much of a CGI expert. If you think I'm wasting my time trying something that can't be done, then let me know. I've searched the forum archives, but only found code on how to add a pulldown to the search box on the search page.

Thanks in advance!

Joe

[This message has been edited by Defraggle (edited September 16, 1999).]
Quote Reply
Re: Converting Default Links To A Pulldown? In reply to
Great idea! Yea, Bobsie, the LINKS Modification Forum Moderator and one of our local experts has implemented such a mod.

Check out his site. He has written some really good mods as well that are located in the Resource Center. If you click on Recommend it in the Modification Section of LINKS in the Resource Center, you can access his site.

He has also included number of hits in the drop-down menus for sub-categories.

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us
Quote Reply
Re: Converting Default Links To A Pulldown? In reply to
Hi Defraggle!

We use drop down menus for our sub categories on the main page. See
www.nzcid.godzone.net.nz/links2-pages/
and
http://www.nzcid.godzone.net.nz/...eds-pages/index.html

I understand that you are trying to do the samething.

Jerry (Widget) helped me complete this mod - happy to send you the site.template.html.pl. You also have to put one other thing in the header of home.html. Ours though is in three columns not 2.

Lets know if thats what you are looking for.
Hope this helps.


------------------
www.nzcid.godzone.net.nz
New Zealand Christian Internet Directory




[This message has been edited by Ian Conza (edited September 16, 1999).]
Quote Reply
Re: Converting Default Links To A Pulldown? In reply to
I like the drop downs on bobsie's page.
I've been searching this forum for the mod, but I'm comming up empty. Can anybody help me out? Thanx
Quote Reply
Re: Converting Default Links To A Pulldown? In reply to
It is not a formal mod, yet, I hope. It seems that while Bobsie has been away from this forum, he has added a bunch of goodies on his site. The drop-down menu is one of the newest features.

We will have to wait and see if he adds it as a formal mod in the Resource Center or informally in this Forum for people to test before releasing it as an official mod.

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us
Quote Reply
Re: Converting Default Links To A Pulldown? In reply to
What is the URL to Bobsie's site?

Dan Smile
Quote Reply
Re: Converting Default Links To A Pulldown? In reply to
Hi guys, thanks for your resposnes.

Eliot, thanks for the Resource Center suggestion. I've checked it out, and found lots of goodies there. Hopefully I'll be able to contribute a few original templates or something soon. Smile

Ian, I checked out your sites, and that looks exactly what I'm trying to do! Very nice layouts (and content) by the way. One for the bookmarks. I also saw a similar layout on Bobsie's site which was very nice. Thanks for the offer to send me the site template perl file! I'd really appreciate it, and it would save me some time. I think my e-mail address is in my profile. Smile

Thanks again guys!

Joe
Quote Reply
Re: Converting Default Links To A Pulldown? In reply to
Hi Dan,

The URL is:

http://goodstuff.orphanage.com
Quote Reply
Re: Converting Default Links To A Pulldown? In reply to
Hi Defraggle, Elliot and everyone else

There does appear to be a difference in the way Bobsie has done the drop down menus and the way they are running on our site.

The drop down menus are not new, look at this site.
www.serve.com/garden/geosearcher/

Aaron has been using this format for sometime and that where we seen the idea. Aaron gave me the code and then Jerry tinkered with it. Jerry said and he can correct me if I am wrong - that he did not like the way the mod called the drop down boxes as it uses the script below just under </heading>

Code:
<script language="JavaScript">

function formHandler(form){
var URL = form.site.options[form.site.selectedIndex].value;
window.location.href = URL;
}
</script>

In viewing the source of Bobsie's page he has come up with another way to call the form and redirect the links. I noted it uses redirect.cgi.

I too would be interested to see the mod Bobsie has come up with Smile

Hope that helps

------------------
www.nzcid.godzone.net.nz
New Zealand Christian Internet Directory

[This message has been edited by Ian Conza (edited September 17, 1999).]
Quote Reply
Re: Converting Default Links To A Pulldown? In reply to
Good eyes, Ian!

Smile

Well, I prefer using cgi over javascript for the most part. I think what Bobsie did was use a common redirection script and then added some sub-routines to pull the needed info, including:

1) hit_cat
2) category_clean
3) URL

Hmm...

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us
Quote Reply
Re: Converting Default Links To A Pulldown? In reply to
bobsies script is simple.. the mod is in sub site_html_print_cat..

something along the lines of this:

Code:
$output .= qq|<form method="post" action="/cgi-bin/redirect.cgi">\n|;
$output .= qq|<select name="category">\n|;
foreach (sort @{$subcategories{$subcat}}) {
$encode = &urlencode($_);
$clean = &build_clean($_);
$output .= qq|<option value="$build_root_url/$encode/$build_index">$clean ($stats{$_})[0]\n|;
}
$output .= qq|</select>\n|;
$output .= qq|</form>\n|;

nevermind.. that is not like bobsies.. just in my opinion a little easier to use.. cause all you need now is a redirect.cgi (i am sure you can find anywhere) that will redirect based on the value of the selection..

i'm not going to tell you guys where to put this code.. cause i think one of you will figure out and it would just be a waste of my time.. BTW (THIS CODE HAS NOT BEEN TESTED OR USED BEFORE.. ALTHOUGH I THINK IT WILL WORK.)

anyways.. if you want to try and make your own script for the redirect.. here is a simple one..

Code:
#!/usr/bin/perl

require "/path/to/links.cfg";
require "$db_lib_path/db_utils.pl";

local (%in) = &parse_form;

if ($in{'category'} =~ m,^http://.*,i) { $url = $in{'category'}; }

$url | |= $build_root_url;
print "Location: $url\n\n";
exit;

the &#0124; &#0124; needs to be closed (delete the space in the middle)... stupid ubb

once again.. this is not tested either.. i just think it will work Wink

all code developed by the most wonderful professional expert cgi software.... THE UBB TEXTAREA... Smile

it will go to your homepage if there is no url or it's not valid..

oh yea.. you need a go button... but the thing is.. you can use onchange so it does it automatically.. but i don't want to tell you how to.. cause i am a lazy boy

jerry

[This message has been edited by widgetz (edited September 17, 1999).]
Quote Reply
Re: Converting Default Links To A Pulldown? In reply to
Very nice job, Jerry!

Cool!

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us
Quote Reply
Re: Converting Default Links To A Pulldown? In reply to
Well okay now what if we don't want to modify the print_cat in site_templates_html and want a short cut pull down like upper right hand corner so that we can still display the old style in <%category%>

------------------
www.webgotcha.com
[b]admin@webgotcha.com[/b]
Quote Reply
Re: Converting Default Links To A Pulldown? In reply to
Hi Elliot!

Smile Well Bobsie and Jerry are far beynd some of here. I think it would be good for other if someone was willing to add the mod to the resource centre, so other can choose whether they wish to run the mod.

Hi Jerry!

Seeing that part of my sub site_html_print_cat is so large it would take me sometime to figure it out. I also think that doing away with the go button and having it go to the link onchange as you say is the better idea. Does away with one other job one has to do.

Just my thoughts.

------------------
http://www.nzcid.godzone.net.nz
New Zealand Christian Internet Directory


Quote Reply
Re: Converting Default Links To A Pulldown? In reply to
Hi Jerry!

I have the redirect.cgi. I figured out where it should go - but how much of your code which has the form onchange built do I change Smile

Code:
$output .= qq~$form_font <FORM name="form"><SELECT NAME="site" SIZE=1 onChange="formHandler(this.form)"><option value="">--Select a Subcategory--~ if ($description =~ /3$/ && $v eq "0");
$output .= qq~<option value="$suburl">$subcategory_name~ if ($description =~ /3$/);
$output .= qq~</select></form> ~ if ($description =~ /3$/ && $v eq $#{$subcategories{$subcat}});
$output .= qq|, | if ($description =~ /1$/ && $v ne "0");
$output .= qq| | if ($description =~ /2$/);
$output .= qq|<a href="$suburl">$subcategory_name</a>|if ($description =~ /1$/ &#0124; &#0124; $description =~ /2$/);
$v++;
}
}
$output .= qq|</small>|;
}
elsif ($#{$subcategories{$subcat}} == 0 && $description eq "SUB3") {
$output .= qq~$form_font <FORM name = "form"><SELECT NAME="site" SIZE=1 onChange="formHandler(this.form)"><option value="">--Select a Subcategory--~;
$output .= qq~<option value="">None</select></form>~;
}
else {
$output .= qq|<dd><span class="descript">$description</span></dd>| if (!($description =~ /^[\s\n]*$/));
}

$output .= qq|</dl>|;
}

Smile

------------------
http://www.nzcid.godzone.net.nz
New Zealand Christian Internet Directory


Quote Reply
Re: Converting Default Links To A Pulldown? In reply to
I wasn't really planning on publishing this as a formal mod but, since there seems to be so much interest, I will do it as soon as I get caught up from my backlog.
Quote Reply
Re: Converting Default Links To A Pulldown? In reply to
Hi Bobsie!

Thanks very much. Look forward to seeing it.



------------------
http://www.nzcid.godzone.net.nz
New Zealand Christian Internet Directory