Gossamer Forum
Home : Products : Links 2.0 : Customization :

Easy question: I just happen to such a scripting :)

Quote Reply
Easy question: I just happen to such a scripting :)
I am trying to have the script print something based on the category it resides in.

For exaple, I have a field for a gif file in my database called "Pic" and I know that if I want that field to be printed all I have to do is type in the tag <%Pic%> on either my links.html or deatained.html template.

Obviously if I want the actual image to be displayed the code will look like:

<%if Pic%>
<img src="<%Pic%>">
<%endif%>

I know how to do simple stuff stuff like this but what I don't know is how to have something printed based on a specific entry on a field.

The category field for example.

If the category = animation I would like it to print "Click here to watch this animation".

The best I can think of is something like.

<%if Category=Animation%>
<a href="<%URL%>">Click here to watch this animation</a>
<%endif%>

but obvioulsy this wrong so can any help me correct this problem?

My site is http://www.flashfilmmaker.com

Another use of this that I plan is to have awards images displayed based on the amoun of hits the URLs have recieved, lets say for example if a site has a hits count between 100 and 1000 silver award will be displayed, if hits = 1000-5000 a gold award will be displayed... and so on.

But I know that in order to get to this point I have to learn to print the results based on the actual entry in the database.
Quote Reply
Re: [Ibis Fernandez] Easy question: I just happen to such a scripting :) In reply to
Add a new field to category.def....in the same way you did <%Pic%>
Quote Reply
Re: [RedRum] Easy question: I just happen to such a scripting :) In reply to
Thanks for the quick reply, the thing is that the Category field is already there, (it's field #4 in links.def)

My conflict is printing something based on the actual contents of that field.

If Category = Blue Companies, print "Take a look at this blue company"

If Category = Red Companies, print "Take a look at this great site"

How about printing something based on what the result is in the Mail field, If Mail=No then print "This user has requested that you keep you spam to yourself so we will not give you his email"


----

Im not sure but I think what im trying to do is perfom a function (it thats what its called) whe if the contents of the fied equals something the a result will be obtaned.

Last edited by:

Ibis Fernandez: Nov 5, 2001, 8:50 AM