Gossamer Forum
Home : Products : Links 2.0 : Discussions :

Help! adding custom graphic to each link

Quote Reply
Help! adding custom graphic to each link
I've been running links 2.0, and I'm considering using it to manage my directory. Is there a way, with fairly simple mods, that I can add a different graphic to each link generated in a search,new, etc! It would be nice to have some links stand out above some others!!!

Any help would be greatly appreciated!
Quote Reply
Re: Help! adding custom graphic to each link In reply to
You could add a new field to links.db that would contain either the name of the graphic you want to display or a path to the graphic you want to display. The former is simpler and would be used, for example, if the graphic to be displayed is one of your's and, regardless of the graphic used, they are all in the same directory. The latter would be used if the user is to include a graphic when they submit or modify a link.

For the first method, you just need to add a text field to contain the name of the graphic and then include an image tag for it when you build the link in site_html.pl or link.html, depeding on whether you do or do not use templates.

If it is the second method you want, then the field should look similar to the URL field because it is going to contain a URL to the image file. Something like:

Quote:
Graphic => [2, 'alpha', 40, 75, 1, 'http://', '^http']

The field length (75) may need to be increased to account for long URLs.

If this is a user submitted URL, then you would need to include <input> tags for the field in the add and modify forms the user completes, to include the forms in the error routines for add and modify.

There are plenty of threads here about adding fields in Links and, since the search for the forum is fixed, I won't go into it again here.

I hope this helps or, at least, gives you ideas on how to proceed.