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

eZ debug

Timing: Jan 19 2025 15:07:30
Script start
Timing: Jan 19 2025 15:07:30
Module start 'content'
Timing: Jan 19 2025 15:07:30
Module end 'content'
Timing: Jan 19 2025 15:07:30
Script end

Main resources:

Total runtime0.0179 sec
Peak memory usage2,048.0000 KB
Database Queries4

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0061 589.3359180.7813
Module start 'content' 0.00610.0055 770.117298.1484
Module end 'content' 0.01160.0062 868.265674.7031
Script end 0.0178  942.9688 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.001910.4544120.0002
Check MTime0.00094.9976120.0001
Mysql Total
Database connection0.00084.344110.0008
Mysqli_queries0.003016.818840.0008
Looping result0.00000.059920.0000
Template Total0.005932.710.0059
Template load0.00084.225710.0008
Template processing0.005128.447110.0051
Override
Cache load0.00052.790910.0005
General
dbfile0.003117.1582100.0003
String conversion0.00000.010630.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs