Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

Adding a Priority Image

Quote Reply
Adding a Priority Image
Hi,

I want some links to have a special image in the category page, and did the following... but now, when I build, ALL of the links have the image:

Added a field to the table:
isPriority, CHAR, Not Null=Yes, Default Value=No

Added this to links.html:
<%if isPriority%>
<small><img src="/priority.gif"></sup></small>
<%endif%>

Modified the links I wanted by changing the value from No to Yes .

Am I missing something?

Thanks,
Emilio

[This message has been edited by ekaram (edited March 09, 2000).]
Quote Reply
Re: Adding a Priority Image In reply to
It has to do with the fact that "no" is a value.

You'd be better off making it an INT field, and you can enter values 0 and 1 (or higher) for priority. You could even then sort on priority.

'0' should return false in an "if" test, while any other value should return "true"

If that still caused problems, you could change the "if" test to be "if isPriority>0"

See how that works Smile

------------------
POSTCARDS.COM -- Everything Postcards on the Internet www.postcards.com
LinkSQL FAQ: www.postcards.com/FAQ/LinkSQL/








Quote Reply
Re: Adding a Priority Image In reply to
If works just perfect making it a INT.

I added the following to links.pm to also make priority links appear first, but it doesn't work... is there any other file I need to change?

$LINKS{build_sort_order_category} = "isPriority,isNew,isPopular,Title";
Quote Reply
Re: Adding a Priority Image In reply to
$LINKS{build_sort_order_category} = "isPriority,isNew,isPopular,Title";


You should make that "isPriority DESC,isNew,isPopular,Title"

Since, you want to sort in DESCending order.

_BUT_ check the FAQ for some threads on sorting -- the way Links does a sort, it merges two different select statments (one for real links, and one for alt-links), and it doesn't do it quite right with multiple-key sorts. Some solutions have been proposed, but Alex has not revealed the "official" solution to it.





------------------
POSTCARDS.COM -- Everything Postcards on the Internet www.postcards.com
LinkSQL FAQ: www.postcards.com/FAQ/LinkSQL/








Quote Reply
Re: Adding a Priority Image In reply to
Thanks, it worked perfectly Smile