Multiple stock pages with forward and back

Does anyone know how to create a button similar to below, I have a lot of stock on some pages, and rather than having a page that just keeps growing in length, I would rather have a page full, then at the bottom, a way that customer can get to next page to view more stock, then scroll back or forward if needed

<First<Previous 12345 next> last>


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I do believe there as an action for that used it once before. It links the previous and next pages in your Freeway Document. But I’m not sure what it’s called. Anyone?

Might be on the http://actionsforge.com

David

Http://www.ineedwebhosting.co.uk

Sent from my iPad

On 29 May 2012, at 20:21, “David Wise” email@hidden wrote:

Does anyone know how to create a button similar to below, I have a lot of stock on some pages, and rather than having a page that just keeps growing in length, I would rather have a page full, then at the bottom, a way that customer can get to next page to view more stock, then scroll back or forward if needed

<First<Previous 12345 next> last>


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Page Navigation. This Action works only with static pages, and it’s built in to Freeway, so I don’t think it’s listed in the Forge. It won’t do anything with a database-driven list of products, though.

Walter

On May 29, 2012, at 3:35 PM, David Owen wrote:

I do believe there as an action for that used it once before. It links the previous and next pages in your Freeway Document. But I’m not sure what it’s called. Anyone?


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

It’s here…

http://actionsforge.com/projects/view/81-link-to-page

And try and chip and support the kickstarter project

http://actionsforge.com/projects/view/81-link-to-page#kickstarter

David

On 29 May 2012, at 20:21, “David Wise” email@hidden wrote:

Does anyone know how to create a button similar to below, I have a lot of stock on some pages, and rather than having a page that just keeps growing in length, I would rather have a page full, then at the bottom, a way that customer can get to next page to view more stock, then scroll back or forward if needed

<First<Previous 12345 next> last>


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

You are correct, my mistake. Still won’t do a database, and it also has another annoyance – every page that you have used it on will publish every time you publish the site, whether or not there are any changes).

Walter

On May 29, 2012, at 3:35 PM, David Owen wrote:

I do believe there as an action for that used it once before. It links the previous and next pages in your Freeway Document. But I’m not sure what it’s called. Anyone?

Might be on the http://actionsforge.com

David

Http://www.ineedwebhosting.co.uk

Sent from my iPad

On 29 May 2012, at 20:21, “David Wise” email@hidden wrote:

Does anyone know how to create a button similar to below, I have a lot of stock on some pages, and rather than having a page that just keeps growing in length, I would rather have a page full, then at the bottom, a way that customer can get to next page to view more stock, then scroll back or forward if needed

<First<Previous 12345 next> last>


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

If you are using a content management system and or a database, then you will need to use a “paging” module in that CMS to get these links and the filtered number of results.

Here’s a long-hand example: if you were showing all the products in your database, you might have something like this in your controller (MyActiveRecord example code):

$products = Product::FindAll('for_sale = 1');

And in your view, you would iterate over these:

foreach($products as $product){
	render_partial('list_item',$product);
}

So if you follow this example, you would then need to limit the initial request, to something like this:

$offset = (present($_GET['offset'])) ? (int) $_GET['offset'] : 0;
$products = Product::FindAll('for_sale = 1', 10, $offset);

The first line just cleans up the page attribute passed in through the URL, and the second uses that variable to get the next 10 records.

You would form your previous and next URLs by adding or removing 10 from the $offset integer, and testing to be sure that there were some results:

$prev_link = ($offset - 10 > 0) '?offset=' . ($offset - 10) : '#';
$next_link = (Product::Count('for_sale = 1') >= $offset + 10) '?offset=' . ($offset + 10) : '#';

As for getting the 2,3,4,5 links in between, that takes an iterative function that basically tests the offset at each step and generates a link. I don’t have an example for that handy, but it’s not that complex to write.

Walter

On May 29, 2012, at 3:21 PM, David Wise wrote:

Does anyone know how to create a button similar to below, I have a lot of stock on some pages, and rather than having a page that just keeps growing in length, I would rather have a page full, then at the bottom, a way that customer can get to next page to view more stock, then scroll back or forward if needed

<First<Previous 12345 next> last>


freewaytalk mailing list
email@hidden
Update your subscriptions at:
List Options | FreewayTalk


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Thanks guys, that worked


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options