Gossamer Forum
Home : Products : Links 2.0 : Customization :

Widgetz/Eliot:Your top sites in category mod.

(Page 1 of 2)
> >
Quote Reply
Widgetz/Eliot:Your top sites in category mod.
Your mod from:
http://www.gossamer-threads.com/scripts/forum/resources/Forum3/HTML/003566.html

Is this feature to difficult?
Your actual mod displays the top hits/rates/votes in a category where links are added.
Example:
I have the category affiliate programs in the
home page.In affiliate programs I have 20 categories.I want to display the top sites
at affiliate programs(the top sites from all the 20 subcategories under affiliate programs).
Your actual mod displays only the top sites in a deeper level(affiliate_programs/pay_per_click) but how to display it at (affiliate_programs)?
Is there a easy way to do this?
Quote Reply
Re: Widgetz/Eliot:Your top sites in category mod. In reply to
I don't know if this help...But you can try the following:

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

Code:
$t1 = time();
print "** Creating Top Sites in Affliates Categories. . .\n";
&build_topaffliate_x;
print "** Done (", time - $t1, " s)!\n\n";


AFTER the following codes:

Code:
$t1 = time();
print "** Creating Top Rated Page. . .\n";
&build_rate_page;
print "** Done (", time - $t1, " s)!\n\n";

2) Then add the following codes in the sub build_all in the nph-build.cgi file:

Code:
# Create Top Sites in Affliate Category
print "Building Top Sites in Affliated Category . . .\n";
&build_topaffliate_x;
print "Done\n\n";

AFTER the following codes:

Code:
# Create Top Rated Page
$use_html ?
print "Building <A HREF=\"$build_ratings_url/$build_index\">Top Rated</A
> Page . . .\n" :
print "Building Top Rated . . .\n";
&build_rate_page;
print "Done\n\n";

3) Then create a new sub-routine called sub build_topaffliate_x routine in your nph-build.cgi file. This should be a copy of the sub build_top_x routine with the following code changes:

Code:
my ($category) = @_;

to the following:

Code:
my ($category eq 'Affliates') = @_;

Also, change the following variables and arrays:

$topcat TO $topaffcat
$@topx TO $topaff
$topxhtml TO $topaffhtml

4) Then you will have to add the following codes in the sub build_category_page:

Code:
$topaff = &build_topaffliate_x ($cat);

AFTER THE FOLLOWING CODES:

Code:
$top = &build_top_x ($cat);

5) Then you will have to add the following tag definition to the sub site_html_category routine in the site_html_templates.pl file:

Code:
top => $topaff,


6) Then you will have to use the Multiple Category Template Mod to print a different template file for the Affliates category page. Or you may be able to use the following codes in your category.html file:

Code:
<%if Category eq "Affliates"%>
<%topaff%>
<%endif%>

Of course, you will need the Enhanced Template.pm mod located in the Resource Center for these codes to work.

7) Then on the Affliates Category template page, add the following codes:

Code:
<%topaff%>

So...to be short...IT will be complicated to do what you want. I do not gaurantee the above codes will work...But logically speaking, they should.

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------






[This message has been edited by Eliot (edited January 09, 2000).]
Quote Reply
Re: Widgetz/Eliot:Your top sites in category mod. In reply to
i don't see how every one of my mods turns into me and eliots mods.. Smile

jerry
Quote Reply
Re: Widgetz/Eliot:Your top sites in category mod. In reply to
Widgetz is absolutely correct.

The Mod (and many others) are Widgetz...100%!

Wink

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------




Quote Reply
Re: Widgetz/Eliot:Your top sites in category mod. In reply to
Sorry widgetz,
I called also Eliot because he/she was/is on of the persons who have understand YOUR mod.

Eliot,
thank for the time you have spend to post the
message.
The only real change is:

code:


my ($category) = @_;



to the following:

code:


my ($category eq 'Affliates') = @_;

I have ad the modification but at build I donīt get an answer from the server.It waits and shows a pop-up window that the server could be busy and I should try it later.
I donīt understand the "eq".
Quote Reply
Re: Widgetz/Eliot:Your top sites in category mod. In reply to
The eq codes says that the $category variable is initiated if there is the Affliate category.

eq means equal.

The reason I wrote that code was because the sub-routine will only be initiated and used for the Affliates category!

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------




Quote Reply
Re: Widgetz/Eliot:Your top sites in category mod. In reply to
my ($category eq 'Affliates') = @_;

doesn't make any sense..

to use the top5 for a category.. you were suppose to just say

$top5_affiliates = &build_top5 ('Affiliates');

jerry
Quote Reply
Re: Widgetz/Eliot:Your top sites in category mod. In reply to
Widgetz,
know I understand nothing.
If you really know how to make top 5 listing
for a category which also looks at the links in their subcategories than please share your
mod with me.
I am near to finish my site layout.This is one thing I need.


gosup
Quote Reply
Re: Widgetz/Eliot:Your top sites in category mod. In reply to
Widgetz,
I think you donīt understand the problem which I have.

$top5_affiliates = &build_top5 ('Affiliates');

You want to call the sub routine with 'Affiliates' as category.Yes?
But the problem is that the topx mod donīt look at the links in the subcategories.
With the above code I would get top5 listing
for the links in the category 'Affiliates'
but it donīt look to the links in the subcategories of 'Affiliates' ('Affiliates/Pay_per_View' or 'Affiliates/Pay_per_Click')
I have only subcategories in the category 'Affiliates' and I want to display the top5
affiliates programs in the 'Affiliates' category.
Quote Reply
Re: Widgetz/Eliot:Your top sites in category mod. In reply to
the original one did..

Code:
foreach (keys %links) {
next unless ($_ =~ m,^$category,);
push (@topx, @{$links{$_}});
}

above..

$db_sort_links = "14";

should do it

jerry
Quote Reply
Re: [widgetz] Widgetz/Eliot:Your top sites in category mod. In reply to
hello, im tryingto install this mod.

but when im add my ($category eq 'Affliates') = @_;

buitd wount to runs.



please help, whats my problem?
Quote Reply
Re: [roman ch.] Widgetz/Eliot:Your top sites in category mod. In reply to
Read the codes that Widgetz posted...you need to use:

$top5_affiliates = &build_top5 ('Affiliates');
========================================
Buh Bye!

Cheers,
Me
Quote Reply
Re: [roman ch.] Widgetz/Eliot:Your top sites in category mod. In reply to
Try to describe your problem in more details.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [webmaster33] Widgetz/Eliot:Your top sites in category mod. In reply to
ok, i do all steps that Eliot poster in TOP message(see to of the page).

then i add category Affliates

then i add subcategory Affliates/Soft

then i add 1 link to Affliates/Soft

then i run build.

then i go to Affliates category and see nothing saying me about new links added in Affliates/Soft subcategory.

there i post my files:

nhp-build.cgi

Edit by Paul: (ATTACHED)
------------------------------------------------------------------------------------------------------

category.html

<%if Category eq "Affliates"%> <%topaff%> <%endif%>

Last edited by:

Paul: Apr 23, 2003, 9:48 AM
Quote Reply
Re: [roman ch.] Widgetz/Eliot:Your top sites in category mod. In reply to
Argh!
DO NOT incude so long code into a thread! NEVER!

Please a moderator, remove the long codes, or delete the post!

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [webmaster33] Widgetz/Eliot:Your top sites in category mod. In reply to
It's dealt with, no need to panic :)
Quote Reply
Re: [Paul] Widgetz/Eliot:Your top sites in category mod. In reply to
Thanks for edit.

No panic. Just haven't seen so much included source code since I'm member of GT forum... Wink

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [roman ch.] Widgetz/Eliot:Your top sites in category mod. In reply to
It seems the
sub build_top_x
and
sub build_topaffliate_x
doesn't do anything useful in build_all. It's called in the build_all, and it doesn't even create a html page.
The result is returned, and is not used in any way. Likely should be output into a .html file...

Anyway, you should check what tags are in the category.html.
It seems you should have <%topaff%> tag in there, and likely it is missing...

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [webmaster33] Widgetz/Eliot:Your top sites in category mod. In reply to
oh, sorry for long code listinf, im really forgot about file attactment function.

to:webmaster33.

i use <%if Category eq "Affliates"%> <%topaff%> <%endif%> tags on my category.html



is its wrong?
Quote Reply
Re: [roman ch.] Widgetz/Eliot:Your top sites in category mod. In reply to
The if should be fine this way.

You should also check if the Affliates category exists.

Anyway, you should actively debug back the important variable contents using Data::Dumper.
Place this code to the questioned code parts, and see what are the variable contents:
Code:
use Data::Dumper;
$Data::Dumper::Indent = 1;
$Data::Dumper::Terse = 1;

&html_print_headers();
print "<br>test_scalar: " . Dumper(\$test_scalar) . "\n";
print "<br>test_array: " . Dumper(\@test_array) . "\n";
print "<br>test_hash: " . Dumper(\%test_hash) . "\n";
(if you check the source code of html page, the variable content will be formatted in a nice way)
So you should check for main variables, and see what are their contents, and this way check where the content disappears, or goes something wrong...
My suggested way is the easiest way to debug links. Tough you could also use debug feature of perl, but Links is too complicated and too long, so that standard way is not efficient enough (however sometimes is useful).

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [webmaster33] Widgetz/Eliot:Your top sites in category mod. In reply to
thank for quote!

hmm im totally dont know how pu put this code to my nph-build.cgi to run it.



i have next now: links builds fine, and i have result in Affliates category.

<table cellpadding="2" cellspacing="0" border="0"><tr><td colspan=4><b>Popular Downloads:</b></td></tr>
</table>

i use a <%topaff%> tag in my category.html file.

so whats can be wrong now?

please help
Quote Reply
Re: [roman ch.] Widgetz/Eliot:Your top sites in category mod. In reply to
Quote:
so whats can be wrong now?
If you don't tell any useful how to help you?
I can not answer for such question...

I told what you have to do. But here's more detailed:
Open source code in a text editor, and go to a function. Where a variable content was set somewhere, you copy the suggested code to there, and it will print out the variable content, so you can see if it's correct.
There is simply no other way to check where are problems in your code.

An example:
1) open site_html_templates.pl,
2) then go into sub site_html_category,
3)
Insert this code:
Code:
use Data::Dumper;
$Data::Dumper::Indent = 1;
$Data::Dumper::Terse = 1;

&html_print_headers();
print "<br>top: " . Dumper(\$top) . "\n";
print "<br>topaff: " . Dumper(\$topaff) . "\n";

Before this code:
Code:
return &load_template ( $cattemplate, {

4) It will print $top and $topaff variable contents to current screen, when you do the build. Check what the printed content is.

Same way you can insert the code above, to any point of site_html_templates.pl or nph-build.cgi. So it will display the content of variable you printed out. You just change the variable name you want to know about it.

Play around with these debugging techniques. Not difficult, and even a non-programmer should be able to copy and paste it as I described.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [webmaster33] Widgetz/Eliot:Your top sites in category mod. In reply to
Quote:
Insert this code:

--------------------------------------------------------------------------------
Code
--------------------------------------------------------------------------------

use Data::Dumper; $Data::Dumper::Indent = 1; $Data::Dumper::Terse = 1; &html_print_headers(); print "<br>top: " . Dumper(\$top) . "\n"; print "<br>topaff: " . Dumper(\$topaff) . "\n";

Data::Dumper is used for dumping complex perl structures. You don't have to go to the effort of loading Data::Dumper to print two scalars, just use:

&html_print_headers();
print "top: $top<br>topaff: $topaff\n";

Last edited by:

Paul: Apr 24, 2003, 8:09 AM
Quote Reply
Re: [Paul] Widgetz/Eliot:Your top sites in category mod. In reply to
Yes, this is true. However he's beginner in Perl.
So I gave him an example debugging scheme, what he can use to dump out ANY kind of structure...
For ARRAYS and HASHes you should use the dumper anyway, and for scalars it's just the same thing, if you copy-paste the code.
Does not matter that in this special case it's a simple scalar variable.
The scheme is same, and we should not confuse him (it's just a copy-paste thing to use that Dumper based debugging scheme for all cases).

Roman ch. needed help, and since nobody was helping him, I took some time to help him, but I really don't have too much time for forum support, especially not for Links 2.0.
So Paul, if you have free time to support his problem, please help him.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...

Last edited by:

webmaster33: Apr 24, 2003, 8:32 AM
Quote Reply
Re: [webmaster33] Widgetz/Eliot:Your top sites in category mod. In reply to
Quote:
Yes, this is true. However he's beginner in Perl.

That's another reason to keep things simple :)
> >