im using this global to call "similar links" in detailed page(its showing random selected links from Father category on detailed page):
global name: diff_detail
my $ID = $_[0];
my $table = $DB->table('CatLinks');
my $sth = $table->select( { LinkID => $ID } ) or return $GT::SQL::error;
my $CatID;
while (my $hit = $sth->fetchrow_hashref) { $CatID = $hit->{CategoryID};
}
return { FatherID => $CatID };
}
in detailed.html im calling it with
<table>
<%include include_detailed_similar.html%></table>
include_detailed_similar.html:
<%set Random_CatID =1'%>
<%pop%>
<%loop Random_Loop%>
<%include link_similar.html%>
<%endloop%><%elseif FatherID eq '2'%>
<%set Random_CatID ='2'%>
<%pop%>
<%loop Random_Loop%>
<%include link_similar.html%>
<%endloop%>
<%elseif FatherID eq '3'%>
<%set Random_CatID ='3'%>
<%pop%>
<%loop Random_Loop%>
<%include link_similar.html%>
<%endloop%>
<%elseif FatherID eq '4'%>
<%set Random_CatID ='4'%>
<%pop%>
<%loop Random_Loop%>
<%include link_similar.html%>
<%endloop%>ETC.
<%endif%>
link_similar.html - just a copy of link.html
its working well when I have 50 categories.
but if i have 1000 categories, its generating 4MB file(detailed.compiled) and as a result overloaded a server.
guys, please help to hack it to make it 1000 categories friendly.
global name: diff_detail
Code:
sub { my $ID = $_[0];
my $table = $DB->table('CatLinks');
my $sth = $table->select( { LinkID => $ID } ) or return $GT::SQL::error;
my $CatID;
while (my $hit = $sth->fetchrow_hashref) { $CatID = $hit->{CategoryID};
}
return { FatherID => $CatID };
}
in detailed.html im calling it with
Code:
<%diff_detail($ID)%> <table>
<%include include_detailed_similar.html%></table>
include_detailed_similar.html:
Code:
<%if FatherID eq 'CatID'%> <%set Random_CatID =1'%>
<%pop%>
<%loop Random_Loop%>
<%include link_similar.html%>
<%endloop%><%elseif FatherID eq '2'%>
<%set Random_CatID ='2'%>
<%pop%>
<%loop Random_Loop%>
<%include link_similar.html%>
<%endloop%>
<%elseif FatherID eq '3'%>
<%set Random_CatID ='3'%>
<%pop%>
<%loop Random_Loop%>
<%include link_similar.html%>
<%endloop%>
<%elseif FatherID eq '4'%>
<%set Random_CatID ='4'%>
<%pop%>
<%loop Random_Loop%>
<%include link_similar.html%>
<%endloop%>ETC.
<%endif%>
link_similar.html - just a copy of link.html
its working well when I have 50 categories.
but if i have 1000 categories, its generating 4MB file(detailed.compiled) and as a result overloaded a server.
guys, please help to hack it to make it 1000 categories friendly.