Mailing List Archive

$burner->page_uri ?
Hi ho,

I'm trying to figure out how to find the complete file name for the
page currently being burned, e.g.: index1.html, index2.html,
index3.html, etc. I can't seem to tease it out of the $burner methods
for some reason.

Basically, I've got a "pager" (pagination) on a cover page like so:

<< Previous 1 2 3 4 5 6 Next >>

I'd like to change the class on the element for the "current" page
being burned so that I can visually distinguish it from the rest.
However, I can't seem to find a way to get the filename for the
current page being burned, and thus can't make the comparison to the
link in that specific pager list item. Here's the code I'm using at
the moment:

% if ($burner->get_page || $burner->get_burn_again) {
<div class="pagination">
<ul>
% if (my $prev = $burner->prev_page_uri) {
<li><a href="<% $prev %>" class="prevnext disablelink">Previous</a></li>
% }
% for my $page (1..$page_count) {
% my $page_no = $page;
<li><a href="index<% $page_no == 1 ? $page_no = '' : $page_no -1
%>.shtml"><% $page %></a></li>
% }
% if (my $next = $burner->next_page_uri) {
<li><a href="<% $next %>" class="prevnext">Next</a></li>
% }
</ul>
% if (!$burner->next_page_uri) {
<p>Nothing else!</p>
% }
</div>
% }

Many thanks in advance for any thoughts you might have.

Phillip.

--
Phillip Smith // Simplifier of Technology // COMMUNITY BANDWIDTH
www.communitybandwidth.ca // www.phillipadsmith.com
Re: $burner->page_uri ? [ In reply to ]
On Mar 18, 2010, at 9:30 AM, Phillip Smith wrote:

> I'm trying to figure out how to find the complete file name for the page currently being burned, e.g.: index1.html, index2.html, index3.html, etc. I can't seem to tease it out of the $burner methods for some reason.
>
> Basically, I've got a "pager" (pagination) on a cover page like so:
>
> << Previous 1 2 3 4 5 6 Next >>
>
> I'd like to change the class on the element for the "current" page being burned so that I can visually distinguish it from the rest. However, I can't seem to find a way to get the filename for the current page being burned, and thus can't make the comparison to the link in that specific pager list item. Here's the code I'm using at the moment:

$burner->get_page returns the page number, starting from 0. So if you're on page 4, it will return 3.

Best,

David
Re: $burner->page_uri ? [ In reply to ]
On 18-Mar-10, at 3:02 PM, David E. Wheeler wrote:

> On Mar 18, 2010, at 9:30 AM, Phillip Smith wrote:
>
>> I'm trying to figure out how to find the complete file name for the
>> page currently being burned, e.g.: index1.html, index2.html,
>> index3.html, etc. I can't seem to tease it out of the $burner
>> methods for some reason.
>>
>> Basically, I've got a "pager" (pagination) on a cover page like so:
>>
>> << Previous 1 2 3 4 5 6 Next >>
>>
>> I'd like to change the class on the element for the "current" page
>> being burned so that I can visually distinguish it from the rest.
>> However, I can't seem to find a way to get the filename for the
>> current page being burned, and thus can't make the comparison to
>> the link in that specific pager list item. Here's the code I'm
>> using at the moment:
>
> $burner->get_page returns the page number, starting from 0. So if
> you're on page 4, it will return 3.

Ah, yes, of course! :-) Many thanks... working version of
pagination.mc is now:

<%args>
$page_count => undef
</%args>
% if ($burner->get_page || $burner->get_burn_again) {
% my $page_no = $burner->get_page + 1;
<div class="pagination">
<ul>
% if (my $prev = $burner->prev_page_uri) {
<li><a href="<% $prev %>" class="prevnext disablelink">Previous</a></li>
% }
% for my $page (1..$page_count) {
% my $link = $page;
<li><a href="index<% $link == 1 ? $link = '' : $link -1 %>.shtml" <%
$page == $page_no ? 'class="currentpage"' : '' %>><% $page %></a></li>
% }
% if (my $next = $burner->next_page_uri) {
<li><a href="<% $next %>" class="prevnext">Next</a></li>
% }
</ul>
% if (!$burner->next_page_uri) {
<p>Nothing else!</p>
% }
<p>Page <% $page_no %> of <% $page_count %></p>
</div>
% }


--
Phillip Smith // Simplifier of Technology // COMMUNITY BANDWIDTH
www.communitybandwidth.ca // www.phillipadsmith.com