Gossamer Forum
Home : General : Perl Programming :

How can this be done?

Quote Reply
How can this be done?
Hi,
I would like for when someone submits a link to my site that certain things happen if the submission matches the requirements. I know of the basic ones in the script that are to the effect of if this field = yes ...list this. Let's say I had a form field that asked the following question. Does your site use java? if the answer is yes i would like the script to put a little java logo in the listing. And will adding a link to that logo listing be just as easy. e.g if the site used shockwave i would like the shockwave logo to link to macromedia's shockwave plug-in page. One last thing and also if the answer is no I would like for another image to be listed..sort of a grayscaled version. hopes this makes some sense.


bye for now.
Quote Reply
Re: How can this be done? In reply to
Actually, what you want to do is rather easy. In the site_html.pl file, you can see what you'll need to do with the what's new and what's cool areas. If you wanted a graphic for shockwave that links to macromedia, you could put:

if ($rec{'shockwave'} eq "Yes") { $output .= qq| <a href="http://www.macromedia.com"><img src="/images/shockwave.gif" border="0"></a> |; }

If you have a field with multiple choices, you can use else if statements to get your desired output:

if ($rec{'country'} eq "USA") { $output .= qq| <img src="/images/usa.gif"> |; }
elsif ($rec{'country'} eq "Canada") { $output .= qq| <img src="/images/canada.gif"> |; }
else { $output .= qq| <img src="/images/unknown.gif"> |; }
Quote Reply
Re: How can this be done? In reply to
thanks alot.

bye for now.
Quote Reply
Re: How can this be done? In reply to
For this slight MOD to work is the site_html.pl file the only file that needs to be updated? I would like to add a field for users to include a small image with their link if their site contains flash. If there needs to be any other scripts changed which are they?
Quote Reply
Re: How can this be done? In reply to
I have been writting a mod for Links (waiting for 2.0 Final to publish) that will allow reviews posting by external users. The purpose of this module is to allow a links DB to act as a pseudo bookstore interface to an Amazon Associate account. The reviews work in much the same way as those on Amazon. I will have reviews stored by category of reviewer and rating of reviewer and then all that information is extracted upon a build. The trick for me was that I only wanted data in the build if it could be DETECTED that the item had written reviews. I could have done this in site-html, but in order to DETECT the review, I first kept the review in a text file, and then checked for existance of a review. If it was there, I turn on the flag for the review in NPH build, much like it is done for isNew and isCool.

If this is the kind of function you are looking for, its a bit more detailed to do, but not really that difficult.


------------------
Fred Hirsch
Web Consultant & Programmer