Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Bricolage: users

$burner->page_uri ?

 

 

Bricolage users RSS feed   Index | Next | Previous | View Threaded


phillip at communitybandwidth

Mar 18, 2010, 9:30 AM

Post #1 of 3 (748 views)
Permalink
$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


david at kineticode

Mar 18, 2010, 1:02 PM

Post #2 of 3 (699 views)
Permalink
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


phillip at communitybandwidth

Mar 18, 2010, 2:18 PM

Post #3 of 3 (702 views)
Permalink
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

Bricolage users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.