Gossamer Forum
Home : Products : Links 2.0 : Discussions :

Graphics with descriptions!

Quote Reply
Graphics with descriptions!
I have incorporated many of the mod's and fixes that are found in this forum. Ihave also made a few changes myself. I do not no very much about perl yet, but I am plugging away at it. One of the things that I have done is added Logo Links, gives you the ability to charge for listings that have the company logo next to the description ans sorts and place that site to the top of the search without giving up on the cool or whats's new sorts. My site is new right now and I'am trying to get the index filled up, so if you would like to add your site and (temporarily, your banner) it would be appreciated. If you see anything on my site that you would like to know how I did it just let me know.


------------------
Joker
Concepts 2000 Online
www.concepts2000.com
tech@concepts2000.com

Quote Reply
Re: Graphics with descriptions! In reply to
One of the things that I have done is added Logo Links, gives you the ability to charge for listings that have the company logo next to the description ans sorts and place that site to the top of the search
==============
I would be interested in knowing how you did this especially placing a site on top in search results.

Thanks
Quote Reply
Re: Graphics with descriptions! In reply to
It was pretty simple really, I added to new fields, one for graphics and the other for priority ( yes/no ). Then I changed the sort routine to sort on priority first before new and cool. Then I changed the links.html file to show it. When you sell a logo link you put in the graphic and put the pririty to "yes" , you need both fields, you can't search on a logo.

I'am kind of rushed for time right now so I apoligize that I didn't paste the code here but I have noticed through out this forum that you are very familiar with perl, so I asume that you will probly go right to it.

By the way did you check out my site?


------------------
Joker
Concepts 2000 Online
www.concepts2000.com
tech@concepts2000.com

Quote Reply
Re: Graphics with descriptions! In reply to
Joker-Just a general note: you need to fix the targeting of the Yahoo style menu bar that comes out above each category (i.e. the <%titlelinked%> variable). When I clicked on it, it loaded the entire frameset in the center frame instead of refreshing the whole page Wink
Quote Reply
Re: Graphics with descriptions! In reply to
Thanx for noticing , I always seem to miss a thing or two. I'll get to it right away.

------------------
All fixed, Thanx Brad.

------------------
Joker
Concepts 2000 Online
www.concepts2000.com
tech@concepts2000.com



[This message has been edited by Joker (edited April 18, 1999).]
Quote Reply
Re: Graphics with descriptions! In reply to
Ok, sorry about that, I had to take care of a few problems. Well here goes, this is the first time I've tried to explain these things:

in the links.def :

find:

# Definition of your database file.
%db_def = (
ID => [0, 'numer', 5, 8, 1, '', ''],
Title => [1, 'alpha', 40, 75, 1, '', ''],
URL => [2, 'alpha', 40, 75, 1, 'http://', '^http|news|mailto|ftp'],
Date => [3, 'date', 15, 15, 1, \&get_date, ''],
Category => [4, 'alpha', 0, 150, 1, '', ''],
AltCategories => [5, 'alpha', 0, 500, 0, '', ''],
Description => [6, 'alpha', '40x3', 500, 0, '', ''],
'Contact Name' => [7, 'alpha', 40, 75, 1, '', ''],
'Contact Email' => [8, 'alpha', 40, 75, 1, '', '.+@.+\..+'],
Hits => [9, 'numer', 10, 10, 1, '0', '\d+'],
isNew => [10, 'alpha', 0, 5, 0, 'No', ''],
isPopular => [11, 'alpha', 0, 5, 0, 'No', ''],
Rating => [12, 'numer', 10, 10, 1, 0, '^[\d\.]+$'],
Votes => [13, 'numer', 10, 10, 1, 0, '^\d+$'],
ReceiveMail => [14, 'alpha', 10, 10, 1, 'Yes', 'No|Yes']

);

and replace with:

# Definition of your database file.
%db_def = (
ID => [0, 'numer', 5, 8, 1, '', ''],
Title => [1, 'alpha', 40, 75, 1, '', ''],
URL => [2, 'alpha', 40, 75, 1, 'http://', '^http|news|mailto|ftp'],
Date => [3, 'date', 15, 15, 1, \&get_date, ''],
Category => [4, 'alpha', 0, 150, 1, '', ''],
AltCategories => [5, 'alpha', 0, 500, 0, '', ''],
Description => [6, 'alpha', '40x3', 500, 0, '', ''],
'Contact Name' => [7, 'alpha', 40, 75, 1, '', ''],
'Contact Email' => [8, 'alpha', 40, 75, 1, '', '.+@.+\..+'],
Hits => [9, 'numer', 10, 10, 1, '0', '\d+'],
isNew => [10, 'alpha', 0, 5, 0, 'No', ''],
isPopular => [11, 'alpha', 0, 5, 0, 'No', ''],
Rating => [12, 'numer', 10, 10, 1, 0, '^[\d\.]+$'],
Votes => [13, 'numer', 10, 10, 1, 0, '^\d+$'],
ReceiveMail => [14, 'alpha', 10, 10, 1, 'Yes', 'No|Yes'],
Graphic => [15, 'alpha', 40, 75, 0, '', ''],
Priority => [16, 'alpha', 0, 5, 1, 'No', 'No|Yes']
);

Next find:

# where the first field equals 0.
$db_alt = 5;
$db_category = 4; $db_modified = 3; $db_url = 2;
$db_hits = 9; $db_isnew = 10; $db_ispop = 11;
$db_contact_name = 7; $db_contact_email = 8; $db_title = 1;
$db_votes = 13; $db_rating = 12; $db_mail = 14;

And replace with:

# where the first field equals 0.
$db_alt = 5; $db_priority = 16;
$db_category = 4; $db_modified = 3; $db_url = 2;
$db_hits = 9; $db_isnew = 10; $db_ispop = 11;
$db_contact_name = 7; $db_contact_email = 8; $db_title = 1;
$db_votes = 13; $db_rating = 12; $db_mail = 14;

Next find:

# 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',
Rating => 0,
Votes => 0,
ReceiveMail => 'Yes'

);

And replace with:

# 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',
Priority => 'No',
Hits => '0',
Rating => 0,
Votes => 0,
ReceiveMail => 'Yes'

);

Next find:

# 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',
ReceiveMail => 'Yes,No'
);

And replace with:

# 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',
ReceiveMail => 'Yes,No',
Priority => 'Yes,No'
);

Now we go to db.utils

And find:

sub build_sorthit {
# --------------------------------------------------------
# This function sorts a list of links. It has been modified to sort
# new links first, then cool links, then the rest alphabetically. By modifying
# the sort function below, you can sort the links however you like (by date,
# or random, etc.).
#
my (@unsorted) = @_;
my ($num) = ($#unsorted+1) / ($#db_cols+1);
my (%sortby, %isnew, %iscool, $hit, $i, @sorted);

for ($i = 0; $i < $num; $i++) {
$sortby{$i} = $unsorted[$db_sort_links + ($i * ($#db_cols+1))];
($unsorted[$db_isnew + ($i * ($#db_cols+1))] eq "Yes") and ($isnew{$i} = 1);
($unsorted[$db_ispop + ($i * ($#db_cols+1))] eq "Yes") and ($iscool{$i} = 1);
}
foreach $hit (sort {

($isnew{$b} and !$isnew{$a}) and return 1;
($isnew{$a} and !$isnew{$b}) and return -1;
($iscool{$b} and !$iscool{$a}) and return 1;
($iscool{$a} and !$iscool{$b}) and return -1;
($isnew{$a} and $isnew{$b}) and return lc($sortby{$a}) cmp lc($sortby{$b});
($iscool{$a} and $iscool{$b}) and return lc($sortby{$a}) cmp lc($sortby{$b});
return lc($sortby{$a}) cmp lc($sortby{$b});
} (keys %sortby)) {
$first = ($hit * $#db_cols) + $hit;
$last = ($hit * $#db_cols) + $#db_cols + $hit;
push (@sorted, @unsorted[$first .. $last]);
}
return @sorted;
}

And replace with:

sub build_sorthit {
# --------------------------------------------------------
# This function sorts a list of links. It has been modified to sort
# new links first, then cool links, then the rest alphabetically. By modifying
# the sort function below, you can sort the links however you like (by date,
# or random, etc.).
#
my (@unsorted) = @_;
my ($num) = ($#unsorted+1) / ($#db_cols+1);
my (%sortby, %priority, %isnew, %iscool, $hit, $i, @sorted);

for ($i = 0; $i < $num; $i++) {
$sortby{$i} = $unsorted[$db_sort_links + ($i * ($#db_cols+1))];
($unsorted[$db_priority + ($i * ($#db_cols+1))] eq "Yes") and ($priority{$i} = 1);
($unsorted[$db_isnew + ($i * ($#db_cols+1))] eq "Yes") and ($isnew{$i} = 1);
($unsorted[$db_ispop + ($i * ($#db_cols+1))] eq "Yes") and ($iscool{$i} = 1);
}
foreach $hit (sort {
($priority{$b} and !$priority{$a}) and return 1;
($priority{$a} and !$priority{$b}) and return -1;
($isnew{$b} and !$isnew{$a}) and return 1;
($isnew{$a} and !$isnew{$b}) and return -1;
($iscool{$b} and !$iscool{$a}) and return 1;
($iscool{$a} and !$iscool{$b}) and return -1;
($priority{$a} and $priority{$b}) and return lc($sortby{$a}) cmp lc($sortby{$b});
($isnew{$a} and $isnew{$b}) and return lc($sortby{$a}) cmp lc($sortby{$b});
($iscool{$a} and $iscool{$b}) and return lc($sortby{$a}) cmp lc($sortby{$b});
return lc($sortby{$a}) cmp lc($sortby{$b});
} (keys %sortby)) {
$first = ($hit * $#db_cols) + $hit;
$last = ($hit * $#db_cols) + $#db_cols + $hit;
push (@sorted, @unsorted[$first .. $last]);
}
return @sorted;
}

And finally:
In link.html

Place this whereever you want the logo to appear:

<%if Graphic%>
<a href="<%db_cgi_url%>/jump.cgi?ID=<%ID%>" target="_blank"><img src="http://www.concepts2000.com/Images/Logolinks/<%Graphic%>" border="0"></a>
<%endif%>


That should be it. Sorry about the lack indent. I would also appreciate everybody helping me with content and add your site to our site.

Thanx,

------------------
Joker
Concepts 2000 Online
www.concepts2000.com
tech@concepts2000.com



[This message has been edited by Joker (edited April 18, 1999).]
Quote Reply
Re: Graphics with descriptions! In reply to
Thanks Joker, for the info. However, I was looking for something a bit different that this. I have already implemented this. Here is a question: I have not enabled or tried the search function yet, I am still building the site. So, I was wondering if this method also puts those links on top, when someon searches? (I know it does in the listings page)

As far as the logo goes here is what I was looking for: I have detailed pages and I wanted to give an option of placing their logo in lieu of a rotating ad on these pages. I tried the If Else routine, but there is a problem with that and it does not work. By using the above method as described you, which is used for new, and editors pick images, I can either display an image of just leave it blank. It does not permit me to put a rotating ad if they did not pay for their logo displayed. So, in essence the space will be left blank if No Logo.

I hope that makes sense. I wish we could get to work that IF ELSE routine, soon.

Thanks
Quote Reply
Re: Graphics with descriptions! In reply to
 
=========================================================

"I have not enabled or tried the search function yet, I am still building the site. So, I was wondering if this method also puts those links on top, when someon searches? (I know it does in the listings page)"

=========================================================




The answer to this is yes and no, it will bring the listing with the logo to the top of each catagory that has a result from your search.




=========================================================

I have detailed pages and I wanted to give an option of placing their logo in lieu of a rotating ad on these pages. I tried the If Else routine, but there is a problem with that and it does not work. By using the above method as described you, which is used for new, and editors pick images, I can either display an image of just leave it blank. It does not permit me to put a rotating ad if they did not pay for their logo displayed. So, in essence the space will be left blank if No Logo.

=========================================================


I'm not sure but I think if you edited your detailed.html and placed your if/else routine there you may get the results you wanted.

ie:

<!-- Links in this category. -->
<%if links%>
<tr><td colspan="2"> </td></tr>
<tr><td width="100"><font face="Verdana" size="3"><b>Logo Links </b></font></td><td><font face="Verdana" size="3"><b>Sites:</b></font></td></tr>
<%links%>
<%else%>

<!-- Rotatating ads -->

<tr><td colspan="2"> </td></tr>

<tr><td colspan="2"><ul><font face="Verdana" size="2"><%rotatingad%></font></ul></td></tr>

<%endif%>


I odn't know if this will work as I don't have detailed pages to try it out on, but it seems to me that it would. Let me know if it does.


------------------
Joker
Concepts 2000 Online
www.concepts2000.com
tech@concepts2000.com