Hi All,
How to list 5 lastlink for specific category, for example, i have 3 main category:
1-Ringtones
2-Operator Logo
3-Picture Message
On each main category have a multi subcategory, what i need is a global tag to list down 5 from each main category, let say:
Ringtones:
<%ringtones> - I can put this tag anywhere on any template for list 5 last ringtones on my database
Operator Logo:
<%operator_logo%> - I can put this tag anywhere on any template for list 5 last operator logo on my database ....etc
I just found the global tag below for list 5 lastlin on each main category, i think it can be specific, but how and please help.
my ($rec) = @_;
my $id = $rec->{ID};
my $db = $DB->table ('Links','CatLinks');
$db->select_options ('ORDER BY ID DESC', 'LIMIT 5');
my $sth = $db->select ( { 'CatLinks.CategoryID' => $id}, ['Links.ID', 'Links.Title', , 'Links.URL'], { isValidated => 'Yes'} );
my $toplinks;
while (my ($id,$name,$url) = $sth->fetchrow_array) {
$toplinks .= "<li><a href='$url'>$name</a>";
}
return $toplinks;
}
Thank you.
How to list 5 lastlink for specific category, for example, i have 3 main category:
1-Ringtones
2-Operator Logo
3-Picture Message
On each main category have a multi subcategory, what i need is a global tag to list down 5 from each main category, let say:
Ringtones:
<%ringtones> - I can put this tag anywhere on any template for list 5 last ringtones on my database
Operator Logo:
<%operator_logo%> - I can put this tag anywhere on any template for list 5 last operator logo on my database ....etc
I just found the global tag below for list 5 lastlin on each main category, i think it can be specific, but how and please help.
Code:
sub { my ($rec) = @_;
my $id = $rec->{ID};
my $db = $DB->table ('Links','CatLinks');
$db->select_options ('ORDER BY ID DESC', 'LIMIT 5');
my $sth = $db->select ( { 'CatLinks.CategoryID' => $id}, ['Links.ID', 'Links.Title', , 'Links.URL'], { isValidated => 'Yes'} );
my $toplinks;
while (my ($id,$name,$url) = $sth->fetchrow_array) {
$toplinks .= "<li><a href='$url'>$name</a>";
}
return $toplinks;
}
Thank you.