Forums / Setup & design / Previous and Next image in gallery is always the same as the current image..

Previous and Next image in gallery is always the same as the current image..

Author Message

Felix Laate

Wednesday 10 November 2004 2:03:33 am

Hi all!

In a gallery the links to the previous and next image always results in the same image as currently is shown...

Here's the code:


 previous_image=fetch_alias( subtree, hash( parent_node_id, $node.parent_node_id,
                                                class_filter_type, include,
                                                class_filter_array, array( 'image' ),
                                                limit, 1,
                                                attribute_filter, array( and, array( $sort_column, $sort_order|choose( '>', '<' ), $sort_column_value ) ),
                                                sort_by, array( $sort_column, $sort_order|not ) ) )
     next_image=fetch_alias( subtree, hash( parent_node_id, $node.parent_node_id,
                                            class_filter_type, include,
                                            class_filter_array, array( 'image' ),
                                            limit, 1,
                                            attribute_filter, array( and, array( $sort_column, $sort_order|choose( '<', '>' ), $sort_column_value ) ),
                                            sort_by, array( $sort_column, $sort_order ) ) ) }



        {section show=is_unset( $versionview_mode )}
        <div class="content-navigator">
			
			<!-- Forrige dersom det finnes -->
		
            {section show=$previous_image}
                
                    <a href={$previous_image[0].url_alias|ezurl} title="{$previous_image[0].name|wash}"><img src="/design/news/images/tilbake.gif"></a>
                
			
			<!-- Dersom forrige ikke finnes -->	
				
            {section-else}
                
                    <img src="/design/news/images/tilbake_tom.gif">
              
            {/section}           

			<!-- Dersom neste bilde finnes -->
			
            {section show=$next_image}
               
                    <a href={$next_image[0].url_alias|ezurl} title="{$next_image[0].name|wash}"><img src="/design/news/images/fram.gif"></a>
                
							
			<!-- Dersom det ikke finnes -->	
				
            {section-else}
                
                    <img src="/design/news/images/fram_tom.gif">
                
            {/section}

Happy for any help!

felix

Publlic Relations Manager
Greater Stavanger
www.greaterstavanger.com

Wenyue Yu

Wednesday 10 November 2004 2:38:49 am

Hi,

I guess the problem is because of fetch_alias operator which may have potential bug. Try fetch function instead.

Regards,
wenyue

Felix Laate

Wednesday 10 November 2004 5:52:12 am

Thanx for your swift answer..

I changed fetch_alias to fetch (and only that). But it didn't do the trick. Di I need to change the whole fetch-funcions?

felix

Publlic Relations Manager
Greater Stavanger
www.greaterstavanger.com

Felix Laate

Wednesday 10 November 2004 11:45:11 am

Ahaaa.. found it. Was obvious I guess.


next_image=fetch('content','tree', hash(parent_node_id, $node.parent_node_id,
                                            class_filter_type, include,
                                            class_filter_array, array( 'image' ),
                                            limit, 1,
                                            attribute_filter, array( and, array( $sort_column, $sort_order|choose( '<', '>' ), $sort_column_value ) ),
                                            sort_by, array( $sort_column, $sort_order ) ) ) }

Publlic Relations Manager
Greater Stavanger
www.greaterstavanger.com