This question is answered.


Permlink Replies: 8 - Pages: 1 - Last Post: 25-Nov-2018 17:30 Last Post By: jGromit Threads: [ Previous | Next ]
jGromit

Posts: 7,502
Registered: 31-Jan-2006
Current, next, and previous within fileiterator
Posted: 24-Nov-2018 07:47
 
  Click to reply to this thread Reply
Having a "brain freeze" moment. In theory, the current, next, and previous variables should be accessible from within a fileiterator. But next and previous seem to be void or null at all times - only current is defined. I'm not talking about something in slide.htt - this is within a fileiterator in index.htt. For example, these lines in index.htt always come back null:
<ja:fileiterator>
<%System.out.println(currentObject.getVars().get("next"));%>
</ja:fileiterator>
And this blows up because next is always void:
<ja:fileiterator>
<%System.out.println(next);%>
</ja:fileiterator>
What am I doing wrong?
RobM

Posts: 3,170
Registered: 4-Aug-2006
Re: Current, next, and previous within fileiterator
Posted: 24-Nov-2018 11:43   in response to: jGromit in response to: jGromit
 
  Click to reply to this thread Reply
Haven’t tried it, not fired up the Mac yet, but what about the ja:enter tag?
jGromit

Posts: 7,502
Registered: 31-Jan-2006
Re: Current, next, and previous within fileiterator
Posted: 24-Nov-2018 13:35   in response to: RobM in response to: RobM
 
  Click to reply to this thread Reply
RobM wrote:
Haven’t tried it, not fired up the Mac yet, but what about the ja:enter tag?

No, this isn't about folder variables.

I could do this manually, of course - create an array based on currentObject.getChildren() before entering the iterator, and then index into it while iterating. But there seems to be something wrong with the defined variables.
RobM

Posts: 3,170
Registered: 4-Aug-2006
Re: Current, next, and previous within fileiterator
Posted: 24-Nov-2018 15:00   in response to: jGromit in response to: jGromit
 
  Click to reply to this thread Reply
jGromit wrote:
No, this isn't about folder variables.

But there seems to be something wrong with the defined variables.

I think it is just that previous/next are not defined, despite the manual saying so
jGromit

Posts: 7,502
Registered: 31-Jan-2006
Re: Current, next, and previous within fileiterator
Posted: 24-Nov-2018 15:25   in response to: RobM in response to: RobM
 
  Click to reply to this thread Reply
RobM wrote:
I think it is just that previous/next are not defined, despite the manual saying so

That's what my tests are telling me. Oddly, however, current is defined.

ETA: Happily, I don't really need it after all - there's an easier way to do what I'm trying to do. So, if it's just a matter of updating the manual, that would be good enough for now. I don't think anyone has ever tried to use those variables in a fileiterator before. They work OK in slide.htt, which is where you're more likely to need them.
RobM

Posts: 3,170
Registered: 4-Aug-2006
Re: Current, next, and previous within fileiterator
Posted: 24-Nov-2018 16:35   in response to: jGromit in response to: jGromit
 
  Click to reply to this thread Reply
jGromit wrote:
So, if it's just a matter of updating the manual, that would be good enough for now. I don't think anyone has ever tried to use those variables in a fileiterator before. They work OK in slide.htt, which is where you're more likely to need them.
Manual updated. Last time this came up appears to have been with the release of jAlbum 9.4 in 2011.
jGromit

Posts: 7,502
Registered: 31-Jan-2006
Re: Current, next, and previous within fileiterator
Posted: 24-Nov-2018 16:39   in response to: RobM in response to: RobM
 
  Click to reply to this thread Reply
I'll be curious to see what David has to say about it.

The only references I could find to these variables all involved using them within slide.htt. I use it in a couple of skins to preload slide images - makes loading of the next page, like mydog.html, a lot quicker, since mydog.jpg is already in cache before you get to the page.
davidekholm

Posts: 3,564
Registered: 18-Oct-2002
Re: Current, next, and previous within fileiterator
Posted: 25-Nov-2018 17:26   in response to: jGromit in response to: jGromit
Correct
  Click to reply to this thread Reply
I checked the source code. It's apparently so that "next" and "previous" have only been defined for slide pages so please update the docs. I could naturally adjust this for the future on popular demand. It however seems that demand has been rather weak so far :-D
jGromit

Posts: 7,502
Registered: 31-Jan-2006
Re: Current, next, and previous within fileiterator
Posted: 25-Nov-2018 17:30   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
Yeah, first time it's come up in a decade, and it turns out I don't actually need it, anyway.
Legend
Forum admins
Helpful Answer
Correct Answer

Point your RSS reader here for a feed of the latest messages in all forums