Gossamer Forum
Home : Products : Links 2.0 : Customization :

Where is this mod?

Quote Reply
Where is this mod?
Hello,

Forgive my stupidity, but what is the name of this mod and where may I get it?

Example: It looks like this:

Links A|B|C|D|........etc.

Thanks

George

Quote Reply
Re: Where is this mod? In reply to
Don't know if there's a Links mod for this, but Eliot and several others are using DBMAN for this.


--Drew
Quote Reply
Re: Where is this mod? In reply to
Yeah it's using Dbman. It's quite easy to set up and if your familiar with links it shouldn't be a problem. You'll just need to define the path to your links.db and alter the default.cfg to match the fields in links.def

Quote Reply
Re: Where is this mod? In reply to
Links should look something like:

http://www.yoursite.com/cgi-bin/dbman/db.cgi?db=default&uid=&Title=^A&re=on&view_records=View+Records

Make sure you have a ^ before the letter your are searching on (it means "begins with"), and that the query contains "re=on" (it means "search using regular expressions"). Without those two key arguments, you'll just get every link that contains that letter in the title field.

I was going to give a working link to my DBMAN database doing this, but it'd be a bad example because of the way the I have link displayed.

--Drew
Quote Reply
Re: Where is this mod? In reply to
Wouldn't it be possible - for less perl-proficient users like myself - to post more detailed instructions on how to link DBMan and Links 2.0 databases, for instance as a FAQ in the Resource Center? Just a humble question... Wink

Quote Reply
Re: Where is this mod? In reply to
Yeah if anyone wants some instructions some could be posted. However I think most people would be surprised how easy it is to do, also really all of the necessary info on how to do this is given in the standard dbman installation instructions. Also although it can be used alongside links 2 it's not really a mod.


Here is how it's done:


1. Install dbman as it specifies in the instructions.
2. Edit the default.cfg giving the right paths etc….and alter the following:


# Database Definition
# --------------------------------------------------------
# Definition of your database. Format is
# field_name => ['position', 'field_type', 'form-length', 'maxlength', 'not_null', 'default', 'valid_expr']

%db_def = (
ID => [0, 'numer', 5, 8, 1, '', ''],
Title => [1, 'alpha', 40, 75, 1, '', ''],
URL => [2, 'alpha', 40, 75, 1, 'http://', '^http|news|mailto|ftp'],
Date => [3, 'date', 15, 15, 1, \&get_date, ''],
Category => [4, 'alpha', 0, 150, 1, '', ''],
Description => [5, 'alpha', '40x3', 500, 0, '', ''],

Etc……..

Alter the definition above to match the fields in yours links.def (ie copy and paste them across.)


# Select fields. Field name => 'comma seperated list of drop down options'.
%db_select_fields = (
Category =>………………………


Alter the above to include the category names you have in your database.


# Full Path and File name of the database file.
$db_file_name = $db_script_path . "data/links.db";


make sure you put the path to links.db


# Authorization Options
# --------------------------------------------------------
# No Authentication? (1 = "there is no authentication", 0 = "there is authentication")
# If you choose no authentication, then set the permissions of what
# people can do with: @auth_default_permissions below.
$auth_no_authentication = 1;



If using dbman purely as for the search options you'll probably want to turn the above off.


# Default permissions used if there is no authentication, or for a default
# user. (View, Add, Delete, Modify, Admin), 1 = enable, 0 = disable.
@auth_default_permissions = (1,0,0,0,0);


You'll also probably want to change the default permissions to the above. (Ie if you plan to not use the editing options in dbman.


Edit html.pl so that the pages created match your website. (Don't worry, it's no harder than altering templates or site_html.pl etc.. in links).


That's it!

Just change the searchboxes on your site to point to db.cgi instead of search.cgi
(you might need to include some hidden values to get it to work). I did it by just looking at the url output when running a search in the default dbman screen.


To display the links starting with a particular letter eg.A just add the following onto the link you've used to call the db.cgi:

&Title=^a&re=on


Or for links beginning with b:
&Title=^b&re=on

(I got the letter search code above by searching and finding a post in the dbman forum)

Any other questions about how to install, alter dbman etc… are purely dbman related and so should posted in the DBMAN forum.

Much of the code used in dbman is in a similar style to links 2. So ie. if you can alter links 2 you shouldn't find altering bits in dbman a problem.



Glenn



Quote Reply
Re: Where is this mod? In reply to
Thanks a lot for your instructions, Glenn! It really sounds pretty easy. However, I have installed the altavista search mod which I would not like to miss in my search functions. Just hypothetically: would it be possible to add that feature into db.cgi as well?

Quote Reply
Re: Where is this mod? In reply to
A bit difficult for me to say because I have never used the altavista search and I haven't looked at the db search routines yet. I don't have LWP and I think that is needed for the altavista to work.

I'd have thought it's worth trying because in theory it shouldn't be too hard to do.


Glenn

Quote Reply
Re: Where is this mod? In reply to
I wrote some codes to generate those links for you:

in site_html_templates.pl (templates) or site_html.pl (non-templates), add:
Code:
alpha => &alpha,
to the globals hash. remove the "," if this is the last line.

Then add this:
Code:
sub alpha {
#-------------------------------
# Generates some links

$dbman_url = "http://url.com/to/dbman/directory";
@alpha = (A .. Z);
$output .= " \|";
while ($i <= $#alpha) {
$output .= qq| <a href="$dbman_url/db.cgi?db=default&uid=&Title=^$alpha[$i]&view_records=1">$alpha[$i++]</a> \||;
}

return $output;
}
Set $dbman_url to the URL to your DBMAN directory.

If you're using templates, use:
Code:
<%alpha%>
If you aren't, use:
Code:
$alpha
--Drew
Quote Reply
Re: Where is this mod? In reply to
I am working on implementing alphabetical links through DBMAN and managed to connect my links.db to db.cgi and to adapt the link output to my Links 2.0 design. However, how can I display the corresponding "New", "Updated" and "Rating" images when searching through db.cgi? I am grateful for any hint.

Thomas
http://www.japanreference.com
Quote Reply
Re: Where is this mod? In reply to
Edit sub html_record in default.pl.

--Drew
Quote Reply
Re: Where is this mod? In reply to
Thanks a lot, Drew! I've experimented on that already, but how do I call those images? If-statements such as in link.html do not work in default.pl...

Thomas
http://www.japanreference.com
Quote Reply
Re: Where is this mod? In reply to
Oh yeah, duh Smile. Try something like this:
Code:
sub html_record {
# --------------------------------------------------------
# How a record will be displayed. This is used primarily in
# returning search results and how it is formatted. The record to
# be displayed will be in the %rec hash.
my (%rec) = @_; # Load any defaults to put in the VALUE field.
($db_auto_generate and print &build_html_record(%rec) and return);

$db_cgi_url = "http://www.yoursite.com/cgi-bin/links";

print qq|
<ul>
<li><a class="link" href="$db_cgi_url/jump.cgi?ID=$rec{'ID'}"><%Title%></a>
|;
if ($rec{'Description'} ne "") {
print qq|
<span class="descript">- $rec{'Description'}</span>
|;
}
if ($rec{'isNew'} eq "YES") {
print qq|
<small><sup class="new">new</sup></small>
|;
}
if ($rec{'isPopular'} eq "YES") {
print qq|
<small><sup class="pop">pop</sup></small>
|;
}
print qq|
<small class="date">
(Added: $rec{'Date'} Hits: $rec{'Hits'} Rating: $rec{'Rating'} Votes: $rec{'Votes'})
<a href="$db_cgi_url/rate.cgi?ID=$rec{'ID'}">Rate It</a>
</small>
</ul>
|;
}
Or are you really using images for ratings and stuff?


--Drew
Quote Reply
Re: Where is this mod? In reply to
Yes, I am actually using "new", "pop", "updated" and "pick" images... Wink

Thomas
http://www.japanreference.com
Quote Reply
Re: Where is this mod? In reply to
This is excellent and means i could use th esearch functions of dbman. I;ve thought of it but never realised it could be done!!

Would it be possible to pass the category information through aswell?

And could this be adapted to work with Links SQL, and would it mean purchasing a copy of DBMAN SQL?

Thanks in advance


Regards

MDJ1
http://www.isee-multimedia.co.uk
Quote Reply
Re: Where is this mod? In reply to
Okay...that makes things a bit more complicated Frown. So now you're going to have to track down all the code related to that and copy it to DBMAN and then you might have to rewrite some of it.

--Drew
Quote Reply
Re: Where is this mod? In reply to
Well, I am using Bobsie's "New and Updated" mod, it sounds pretty difficult to adapt db.cgi to all those modifications. Anyhow, thanks for your help, Drew, I'll keep on experimenting.

Thomas
http://www.japanreference.com
Quote Reply
Re: Where is this mod? In reply to
Just a suggestion... Ask JPDENI in the DBMAN forums to help with rewriting that mod. She's probably the most knowledable and prolific DBMAN mod creater other there.

--Drew
Quote Reply
Thomas1~~Please help. In reply to
Hi,

As I was searching for how to use DBman with LinksI ran across this thread. Thomas, could please let me know how you intergrated DB with links? I have successfully installed DBman. But that's it. I would very grateful for your help and guidance. I am no perl expert myself.

Thanks

Madonna

Quote Reply
Re: Please help In reply to
If you closely follow Glennu's detailed explanation further up in this thread, there's really not a lot that could go wrong. Wink
Just make sure that your fields in links.def and in default.def correspond. Good luck!

Thomas
http://www.japanreference.com
Quote Reply
Re: Please help In reply to
I don't have a default.def.

Your quote:

"Just make sure that your fields in links.def and in default.def correspond"



Quote Reply
Re: Please help In reply to
IT should be default.cfg NOT default.def. Wink

Regards,

Eliot Lee
Quote Reply
Re: Please help In reply to
Yep, Eliot is of course right! Haven't been into DBMan for a while, mea culpa... Wink

Thomas
http://www.japanreference.com
Quote Reply
Re: Please help In reply to
Thanks Eliot!

YOU ARE THE BEST!

I will go to the DBman forum if I ran into anymore problems.

Madonna