summaryrefslogtreecommitdiff
path: root/pages/results.html
blob: 349e03c0bb86bcedbb8f29cc6f6b7200f8293db4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
@_TOP_@

    <!-- Catalog Content -->
    <div class="container p-4">
      <div class="row text-center text-lg-left pt-2">[search-region][on-match][tmp meta_header][calcn]
	          return unless $Values->{more_link};
	          (my $more_page = $Session->{last_url}) =~ s|^/.*/([^\..]+)(?:\.html)?|$1|;
	          if ($more_page =~ /^(Next|Prev)/) {
                      $Tag->tag({ op => 'header' }, qq{Cache-control: no-cache\nCache-control: no-store\nPragma: no-cache\nExpires: 0\nContent-type: text/html});
	          }
	          ## $mc set above.
	          my $ml = $Values->{mv_matchlimit} || '';
	          my $fm = $Values->{mv_first_match} || '';
	          my ($canon, $rel_prev, $rel_next);
                  #Debug("more_page=$more_page, ml=$ml, fm=$fm, mc=$mc");
	          my ($prev, $next);
	          REL: {
                      last REL if $mc < $ml;
                      if ($fm == 0 || $fm == 1) {  # first page
                          $rel_next = $Values->{more_link} . '/2';
                      } elsif (($mc - $fm - $ml) <= 0) {  # last page
                          $prev = sprintf("%.0f", (($fm+$ml) / $ml) - 1);
                          $rel_prev = $Values->{more_link} . '/' . ($prev ? $prev : '1');
                      } else {  # page 2 to second-to-last
                          $prev = sprintf("%.0f", ($fm / $ml));
                          $next = $prev + 2;
                          $rel_prev = $Values->{more_link} . "/$prev";
                          $rel_next = $Values->{more_link} . "/$next";
                      }
                  }
                  CANON: {
                      last CANON if $more_page !~ /^1|(Next|Prev)/;
                      if ($more_page eq '1') {
                          $canon = '';
                      } else {
                          $canon = sprintf("%.0f", ($fm+$ml) / $ml);
                          $canon = '' if $canon == 1;
                      }
                      $canon = $Values->{more_link} . ($canon ? "/$canon" : '');
                  }
                  my @out;
                  my $url = ($Variable->{SAMPLEURL} . $Variable->{CGI_URL}) || '';
                  my $ext = $Scratch->{mv_add_dot_html} ? '.html' : '';
                  $url !~ /\/$/ and $url .= '/';
                  push @out, qq{<link rel="prev" href="$url$rel_prev$ext">} if $rel_prev;
                  push @out, qq{<link rel="next" href="$url$rel_next$ext">} if $rel_next;
                  $Tag->tmp('rel_next', 1) if $rel_next;
                  push @out, qq{<link rel="canonical" href="$url$canon$ext">} if $canon;
                  if ($prev || $next) { $Scratch->{page_title} = $Scratch->{page_title} . ' - Page ' . (($prev || $next)+1) };
                  return "\t" . join "\n\t", @out;
                  [/calcn][/tmp][/on-match][tmp bw_more][more-list][first-anchor][/first-anchor][last-anchor][/last-anchor][link-template]<li><a href="[area href=|[value more_link]/$ANCHOR$|]">$ANCHOR$</a></li>[/link-template]
                  <nav>
	            <ul class="pagination">
		      {PREV_LINK}{MORE_LIST}[if scratch rel_next]{NEXT_LINK}[/if]
	            </ul>
                  </nav>
                  [/more-list][/tmp][calc]
                  my $more = $Scratch->{bw_more};
                  $more and $more =~ s,<strong>,<li class="active"><a href="#">,;
                  $more and $more =~ s,</strong> *,</a></li>,g;
                  $Scratch->{bw_more} = $more;
                  return $Values->{more_link} ? $more : undef;
                  [/calc][search-list]
        <!-- Product -->
        <div class="col-lg-6 col-md-6">
          <div class=" container">
            <a href="[area [item-code]]" class="d-block h-100">
              <img src="__IMAGE_DIR__/thumb/[item-field thumb]" class="img-fluid img-thumbnail" alt="[item-description]" title="[item-code]">
           </a>
          </div>
          <div class="container">
            <h5 class="text-truncate">[item-description]</h5>
            <h6 class="text-primary">[item-price]</h6>
          </div>
        </div>
        <!-- End of Product -->
        [/search-list][no-match]
                  <div>[comment]
	            Don't show the search string if it was empty, since it looks weird
	            and the user will see the error below anyway.
	            [/comment][tmp matchstring][value-extended name=mv_searchspec joiner=" | " filter=encode_entities][/tmp][if scratch matchstring]
                    [msg arg.0="[scratch matchstring]"]Sorry, no matches for <B>%s</B>.[/msg]
                    [/if][if value mv_search_error]
	            <B>
	              [L]Errors[/L]:
	              <BR>[value-extended name=mv_search_error joiner="<BR>" filter=encode_entities]
	            </B>
	            [/if]
                  </div>
                  [/no-match][if value more_link][scratch bw_more][else][more-list]
	          <div class=morelist>
	            [msg arg.0="[matches]" arg.1="[match-count]"]Matches %s of %s found.[/msg]
	            [link-template]<a href="$URL$" target="_top" class="morelink">$ANCHOR$</a>[/link-template]
	            <BR>[more]<BR>
	          </div>
	          [/more-list]
                  [/else]
                  [/if][/search-region]
      </div>
    </div>
    <!-- .End of Catalog Content -->__BOTTOM__