Forum Moderators: coopster & phranque

Message Too Old, No Replies

Show 10 next page links for visitors, and 25 for a certian USER_AGENT

         

Jesse_Smith

1:43 am on Aug 15, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Is it possible for a perl code something like this to show 10 page links for visitors and 20 page links for a certian user agent?

if ($ENV{'HTTP_USER_AGENT'} =~ /AGENT/) {
$page_num_low + 25 <= $AWS_variables{TotalPages}) { $page_num_high = $page_num_low + 25; }
} else {

if ($page_num_low + 10 <= $AWS_variables{TotalPages}) { $page_num_high = $page_num_low + 10; } else { $page_num_high = $AWS_variables{TotalPages}; }

Damian

10:29 am on Aug 15, 2003 (gmt 0)

10+ Year Member



There are some (syntax) errors in there. I think you want something like this:

[perl]
# if useragent matches agent and $page_num_low + 25 <= TotalPages
if ($ENV{'HTTP_USER_AGENT'} =~ /AGENT/ && $page_num_low + 25 <= $AWS_variables{TotalPages}) {$page_num_high = $page_num_low + 25;}
# elsif useragent did not match agent and $page_num_low + 10 <= TotalPages
elsif ($page_num_low + 10 <= $AWS_variables{TotalPages}) { $page_num_high = $page_num_low + 10; }
# else set $page_num_high to TotalPages
else { $page_num_high = $AWS_variables{TotalPages}; }
[/perl]