Jump to:

3431 Posts in 1025 Topics by 864 members

Template Questions

SilverStripe Forums » Template Questions » peekNext

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1 2 3
Go to End
Author Topic: 1261 Views
  • Blackthorn87
    Avatar
    Community Member
    27 Posts

    peekNext Link to this post

    Hey Guys,

    I've been struggling with this situation for a few hours and have read everything I could find online.

    What I'm doing is displaying Information from a DataObject to create a carousel (using jCarousel). The part I'm struggling with is displaying a bit of information from the next Item, the name, so basically it says next item is called 'item name'.

    I looked on the web for a solution and found something called 'peekNext'. I tried to implement this in the template like so:

    <% control Products %>

    $productName
    $productImage

    <% control peekNext %>$productName<% end_control %>

    <% end_control %>

    But I've had no luck.

    Any Help?

  • swaiba
    Avatar
    Forum Moderator
    1784 Posts

    Re: peekNext Link to this post

    quick google leads me to believe..

    <% if Iterator.peekNext %>

    instead of

    <% if peekNext %>

    and I'd also advise nivo slider over jcarosel anyday of the week (including today)

  • Blackthorn87
    Avatar
    Community Member
    27 Posts

    Re: peekNext Link to this post

    Hey swaiba,

    I tried what you suggested but it failed on me and caused an error.

    I swapped out the

    <% control peekNext %>$productName<% end_control %>

    for this

    <% if Iterator.peekNext %>$productName<% end_if %>

    but to no avail. Just got an error.

  • swaiba
    Avatar
    Forum Moderator
    1784 Posts

    Re: peekNext Link to this post

    yeah my bad - it should work as you have... what does it actually do?

  • Blackthorn87
    Avatar
    Community Member
    27 Posts

    Re: peekNext Link to this post

    From what I understand it's supposed to allow you pull data from the next data object. At least that is the outcome I would like to achieve.

  • swaiba
    Avatar
    Forum Moderator
    1784 Posts

    Re: peekNext Link to this post

    yeah i get that bit, I searched the code and it is reight there is DataObjectSet - I meant what does the above template you are using actually do

  • Blackthorn87
    Avatar
    Community Member
    27 Posts

    Re: peekNext Link to this post

    I'm the process of creating a module and widget set. It creates a dataobject tied to a page type; the data object being a motor home and the page type being a motor home category.

    The peekNext part is part of the widget. It is supposed to display all the motor homes regardless of their category page, which it does. But also on each motor home entry i would like it to display the one that is going to appear next.

    If you get what I'm trying to explain.

  • swaiba
    Avatar
    Forum Moderator
    1784 Posts

    Re: peekNext Link to this post

    I get what you are saying - I'm obviously not being clear enough myself.... what is the code when you execute outputing... is it blank? is it erroring? what is exactly is the result of the code?

    1261 Views
Page: 1 2 3
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.