Gossamer Forum
Home : Products : Links 2.0 : Customization :

Additional code needed, please.

Quote Reply
Additional code needed, please.
First, let me say thanks, Alex, for such a super product!!

I've installed, and am testing Links 1.11 and would like to add a modification
to the Admin Nav.htm as follows:

<A HREF="admin.cgi/links?dbID_search=1" TARGET="cgimain">dbID</A>
where: dbID is the raw db filtered to show only the ID number, url, and Title

Can anyone suggest a script to search the db, pull only these three fields and print to
html? The html output to be super simple, just a 6 cell table like:

<TABLE BORDER="1"><TR>
<TD>ID</TD>
<TD>URL</TD>
<TD>TITLE</TD>
</TR><TR>
<TD>1</TD>
<TD><A HREF="http://" TARGET="_blank">http://</A></TD>
<TD>Home Page</TD>
</TR>
</TABLE>

I presume the script would be added to admin.cgi or search.cgi?

I started configuring and testing 1.11 before 2.0 was announced and am just now
getting it to do most of what I want. I'll want to upgrade to a registered 2.0
soon, but I won't have the luxury of tinkering with it in my spare time, as was
the case with 1.11. Meaning that I'll need to hire the services of one of the
guru's here to make the upgrade installation while protecting all of the present
db and html formatting.

Thanks in advance!

boats

------------------
usamarine.net
boats@usamarine.net
Quote Reply
Re: Additional code needed, please. In reply to
Hi,

This would be much easier to do in 2.0. You can keep your site_html.pl file from 1.1 so upgrading shouldn't be too bad?

Here's an outline of what you should do:

1. Create a subroutine html_record_short in admin_html.pl that looks like:

sub html_record_short {
# ----------------------------------------
my %rec = @_;
print qq~

.. short version of a link
~;
}

then in html_view_success (same file) change:

print "<P>";
($in{'format'} eq 'short') ?
&html_record_short (&array_to_hash($_, @hits)) :
&html_record (&array_to_hash($_, @hits));

Now what you've done is if you pass in 'format=short' to the script, it will display the output using a shorter format. You could then add a checkbox to the search form:

<input type=checkbox name=format value=short>

to toggle it on or off.

Hope this helps,

Alex
Quote Reply
Re: Additional code needed, please. In reply to
Thanks, Alex!

I'm off to give it a try...

Probably try to do the upgrade and registeration some time next week.

I'll try to do it alone, will I need to change much other than my server paths?

Thanks,

boats

------------------
usamarine.net
boats@usamarine.net