3217 Posts in 853 Topics by 812 members
| Go to End | Next > | |
| Author | Topic: | 824 Views |
-
Re: peekNext

17 April 2012 at 2:40am
Sorry mate, the result of the above code is nothing.
When I use
<% control peekNext %>$productName<% end_control %>
I get nothing, no errors, no text, etc.
When I use
<% if Iterator.peekNext %>$productName<% end_if %>
I get
Fatal error: Call to undefined method ArrayIterator::hasValue() in C:\Users\DESKTOP1\AppData\Local\Temp\silverstripe-cacheC--xampp-htdocs-dev_DOM\.cache.module_motorhomes.templates.ProductWidget.ss on line 51
-
Re: peekNext

17 April 2012 at 2:54am
ok, 1) forget "Iterator.peekNext"
2) ok it does nothing... how about this...
<% if peekNext %>hello world
<% control peekNext %>test $someotherfield $ID $Name<% end_control %>
<% end_if %> -
Re: peekNext

17 April 2012 at 3:41am
Sorry mate,
That hasn't wielded any results either. But to be honest, I'm entirely sure how to use the peekNext function, can you actually use it in the template, or do I have to use it in the controller/function?
-
Re: peekNext

30 April 2012 at 8:37pm
Sorry guys, I'm bumping this again.
It would be great if someone could lend a bit of time to solve this, maybe an admin?
Thanks in advance!
-
Re: peekNext

30 April 2012 at 8:55pm
Blackthorn87,
Firstly rather than saying "That hasn't wielded any results either" you might have indicated whether you could see the word "test" at all - that indicated whether you are going into the contorl structures. Second you could open a debugger and stick a breakpoint on the peekNext function to see what is happending. Third you could post a simple example that completely encapsulates/reproduces the problem because there is so *no* "other stuff" that could be affecting this from working - often the problem is not where you think it is.
And if you are after "Admins" then your only reliable hope is to get on IRC when the core devs are present which they are for one hour a week - or to post on the core dev list (but that is more for development decisions rather than support). I don't see silverstripe employees posting on here at all often.
Best of luck!
-
Re: peekNext

30 April 2012 at 9:02pm
Thanks swaiba,
I'll have another go see what happens, posting it on here afterwards.
Watch this space.
-
Re: peekNext

1 May 2012 at 4:13am
Hey swaiba,
I've done this:
<% if peekNext %>hello world
<% control peekNext %>test $someotherfield $ID $Name<% end_control %>
<% end_if %>
and it doesn't enter the control structures as it doesn't display the word 'test'.Here is the actual code i am using on my template:
<div class="MotorHomeWidget">
<div class="nav_holder"></div>
<ul id="MotorHomeWidget" class="jcarousel-skin-viewrange">
<% control ViewOurRange %><li class="$EvenOdd<% if First %> first<% end_if %><% if Last %> last<% end_if %>">
<div class="ViewRangeTitle"><a href="$Link">$Title</a></div>
<p>$Description.LimitCharacters(80)</p>
<a href="$Link">$Image.CroppedImage(200,150)</a>
<% if peekNext %>
test if statement
<% control peekNext %>test $Title $ID<% end_control %>
<% end_if %>
</li><% end_control %>
</ul>
</div>The data the above template is pulling is from a dataobject if that helps.
Also i'm not entirely sure how to:
"open a debugger and stick a breakpoint on the peekNext function"Some pointing in the right direction on that would also be helpful.
Thanks again.
| 824 Views | ||
| Go to Top | Next > |


