access to navigator from theme.tpl? (link rel="next&qu

kbarr

Joined: 2005-08-29
Posts: 11
Posted: Fri, 2005-09-02 05:23

I'm trying to add the following to my theme.tpl file to speed things up. It seems like $theme->navigator is not available in this scope, though, as my url gets filled with ...main.php (when I use .next) or an error like "array_keys(): The first argument should be an array rather than the image link...." (when I use ['next'])

<head>
...
<link rel="next" href="{g->url params=$theme.itemNavigator['next']}" title="Next image" />                                  
<link rel="previous" href="{g->url params=$theme.itemNavigator['back']}" title="Previous image" />   
</head>

Is the navigator actually initialized when theme.tpl is being parsed?
If so, what is the correct syntax to retrieve the image url? I guess this is php question more than a gallery question...

 
lvthunder

Joined: 2003-09-12
Posts: 808
Posted: Fri, 2005-09-02 15:41

Here is the code for a previous image
<a href="{g->url params=$theme.navigator.back.urlParams}" class="previous">Previous</a>
and the next

<a href="{g->url params=$theme.navigator.next.urlParams}" class="next">Next</a>
 
kbarr

Joined: 2005-08-29
Posts: 11
Posted: Fri, 2005-09-02 16:04

thanks. That gives me the appropriate ".html" href (i.e., a link to the *page* that contains the next or previous image). I can't tell if the link-prefetching is working, though. Would it show up in server logs?

Do you know if there is a way to get just the .JPG url -- (i.e., a link to *image* itself?) from the navigator?

 
lvthunder

Joined: 2003-09-12
Posts: 808
Posted: Fri, 2005-09-02 16:14

I guess that would depend on which image size you want it to grab. if you turn on buffered debug mode you can see all the variables that you can use.

 
kbarr

Joined: 2005-08-29
Posts: 11
Posted: Fri, 2005-09-02 17:44

I turned on buffered debug output, but don't see an obvious variables list. I searched for "navigator" and "urlparams" (two of the variables that I -know- exist), but didn't get anything useful: urlparams doesn't appear and the only references to naviagator are to the Navigator.tpl file.

 
kbarr

Joined: 2005-08-29
Posts: 11
Posted: Tue, 2005-09-13 17:25

An update and request for generalization...

The variables list is in a (blocked) popup window, so I didn't notice it until recently. Looks like it doesn't contain what I want. The closest I can come so far to grabbing the JPG (not the html) is:

link rel="next" href="http://cag.csail.mit.edu/~kbarr/photos/gallery2/d/{$theme.navigator.next.item.id+1}-2/{$theme.navigator.next.item.pathComponent}"  title="Next image" 
link rel="prev" href="http://cag.csail.mit.edu/~kbarr/photos/gallery2/d/{$theme.navigator.back.item.id+1}-2/{$theme.navigator.next.item.pathComponent}"  title="Previous image" 

as you can see I've had to make assumptions about the server name, the id of the medium-sized photo (is it guaranteed to be next.item.id+1?), and the serial number (what's that for?). None of this shows up in the debug popup window.

It's working for me, but can this be made more general so someone else can use it?