Gossamer Forum
Home : Products : Links 2.0 : Discussions :

New fields with images

Quote Reply
New fields with images
The idea is to give more detailed information about the link (and the site) itself in.
First of all there would be new field in the database called Other information, which would appear after
link description. That field consists of images only (five images maximum indicating the content of the site, for eg. video, sound, chat ...).

In admin panel there would be also five checkboxes (video, sound, chat ...) and admin could pick up the right ones describing the site best. After rebuilding the database the usual way, and picked checkboxes would appear as images after link description. Of course these images would be already in the web-server.

Did anyone understood what I was chasing after ? This is almost like the image rating mod, but then I dont know if this could be achivied the same way.

All I want to know if this is possible. I don't know any Perl so doing any coding is out of the question.

Quote Reply
Re: New fields with images In reply to
There is probably a far easier way to create this but this will entail little perl modification and should work.

First you need to create the new fields in the links database. I beleive you would have to create a seperate field for each image.

In the default section you could specify the url to the image ie - http://www.abc.com/image/video.gif

Video => [15, 'alpha', 40, 100, 0, 'http://www.abc.com/image/video.gif', 'Yes|No'],

Add your new variables to this table so that you have a default value of No or Yes and so only admin can make changes

# System defaults. When adding new links or modifying links, these fields
# can not be overwritten by a user.
%add_system_fields = (
isNew => 'No',
isPopular => 'No',
Hits => '0',
Priority => 'No',
Votes => 0,
ReceiveMail => 'Yes'

Also add you fields to this, so the script knows that these are yes no values

# Hash of column names to possible options. If you want to use a select form
# field, you can use &build_select_field in your HTML page. This routine will
# make a <SELECT> input tag using the following values:
%db_select_fields = (
isNew => 'Yes,No',
isPopular => 'Yes,No',

you should then be able to add "if" statements to your links.html template

<%if video%>
<%if cd%>
etc etc etc

this way if the script sees that it is marked as yes it will display that image.

There is an update for the templates in the resources center, it would be advisable to use this as it makes it easier to modify the templates. It's quite clearly marked.

Someone correct me if im wrong or there should be more added to this, try it abd let us know how you get on.