Gossamer Forum
Home : Products : Links 2.0 : Customization :

Numbered category results

Quote Reply
Numbered category results
I've searched the forum but cant seem to find out how to do these two modifications:

-Numbers next to category links and search results, that continue on the next spanned page in order.
-Having the real url of a website show up in link results and category pages.

I use templates if that makes any difference. Any help will be most appreciated. Thanks everyone!

Alexia

Quote Reply
Re: Numbered category results In reply to
In Reply To:
Numbers next to category links and search results, that continue on the next spanned page in order.
I can help you with the Category pages...yet I cannot help you with the Search Result pages....

Okay...this is NOT an easy code hack to install for novice programmers, so make sure that you make a back-up of your nph-build.cgi before attempting this hack.

1) Add the following codes in the sub build_category_pages routine in the nph-build.cgi file:

Code:

my $links_count = '0';


BEFORE the following text:

Code:

# Go through each category and build the appropriate page.


2) In the same sub-routine and file, add the following codes:

Code:

$links_count = 0;


before the following text:

Code:

# Store all the category html info in $category.


3) Then in the same sub-routine in the same file, add the following codes:

Code:

$links_count= $links_count+1;
$tmp{'links_count'}= $links_count;


BEFORE the following codes:

Code:

$links .= &site_html_link (%tmp);


Note: There are two occurrences of these codes...and you have to add the codes I provided BEFORE each of them in order for the number to continue on each spanning page.

4) Then add the following codes in the same sub and file:

Code:

$links_count= $links_count+1;
$tmp{'links_count'}= $links_count;


BEFORE the following codes:

Code:

last LINK if ($tmp{$db_key} eq "");


5) Then in your sub site_html_link in the site_html_templates.pl file, add the following codes in the tag definition area:

Code:

links_count => $links_count,


6) Then in your link.html file, add the following tag:

<%links_count%>

7) Then copy your sub site_html_link routine in the site_html_templates.pl and call the new sub-routine, sub site_html_searchlink. This should load searchlink.html RATHER than link.html file.

To do this...you will need to replace the following codes:

Code:

return &load_template ('link.html', {


with the following codes:

Code:

return &load_template ('searchlink.html', {


8) Then create this new template file, searchlink.html. This SHOULD NOT INCLUDE the links_count tag!!

9) Then in your search.cgi script, REPLACE all occurrences of &site_html_link with &site_html_searchlink.

Note: If you do NOT follow steps 7-9, then you will GET an UNKNOWN TAG ERROR (links_count) in your search result pages.

In Reply To:
Having the real url of a website show up in link results and category pages.
Replace the jump.cgi link in the link.html (and in the searchlink.html) with <%URL%>.

Hope this helps.

Regards,


Eliot Lee
Quote Reply
Re: Numbered category results In reply to
Thanks for the help, the numbered mod works perfrectly. I was also wondering if it was possible to have the "whats new" and "whats cool" pages use the "searchlink.html" instead of the "link.html" If this is possible, please let me know.

Thanks again,
Alexia

Quote Reply
Re: Numbered category results In reply to
Like I stated before...I can only help you with the Category pages at this time...you can try applying the same codes I've given in the following subs in the nph-build.cgi file:

sub build_new_page
sub build_cool_page

And the sub main routine in the search.cgi.

Best of luck!

Regards,

Eliot Lee
Quote Reply
Thanks Anthro In reply to
You're a genius Anthro! I got it to work on my Whats Cool and Whats New pages. Thanks for all the help!

Alexia

Quote Reply
Re: Thanks Anthro In reply to
You're welcome.

And actually...pugdog is the genius who wrote similar codes for LINKS SQL and all I did was port the codes to work with Links 2.0. So, pugdog deserves the credit.

Regards,

Eliot Lee
Quote Reply
Re: Thanks Anthro In reply to
Everithyng works well but in the new page. The links are not indexed by the number as in cool or category pages.

Example for better understanding:

12.06.2000
28. Link1 Description1
37. Link 2 Description 2
43. Link 3 Description 3

13.06.2000
5. Link 4 Description 4
12. Link 5 Description 5
...
(In my links.cfg I have $build_span_pages = 0; )

Any suggestion?


Quote Reply
Re: Thanks Anthro In reply to
I was gonna make this for links 2 after i finish everything else, and for search, it would pretty much be the same, and when you go to the next page, you would add 11 to the variable when the loop ends

Quote Reply
Re: Thanks Anthro In reply to
Cool, Bmxer...however, I have failed at all attempts to do this in the search.cgi script (of course, I have tons of Mods and code hacks...so, it probably would work with the default search.cgi).

Wink

Looking forward to what you come up with...and I will try to help you with the relevancy search when I get a chance.

Regards,

Eliot Lee
Quote Reply
Re: Thanks Anthro In reply to
The problem is that the links are being sorted by $category not by links themselves...there would need to be further codes applied to make it work in the NEW page.

Regards,

Eliot Lee