Share » Forums » Developer » Navigate blog posts

Navigate blog posts

Navigate blog posts

Tuesday 21 June 2011 1:56:40 am - 4 replies

Modified on Tuesday 21 June 2011 2:12:04 am by Kim Bjurling

Author Message

Ivo Lukac

Tuesday 21 June 2011 2:56:38 am

Hi

Search for override/templates/full/gallery.tpl for example of code, it does the same thing...

http://www.linkedin.com/in/ivolukac
http://www.netgen.hr/eng/blog
http://twitter.com/ilukac

Kim Bjurling

Tuesday 21 June 2011 3:13:39 am

Hi

Search for override/templates/full/gallery.tpl for example of code, it does the same thing...

Alright, thanks :)

Kim Bjurling

Wednesday 29 June 2011 6:01:26 am

If someone looking after similar functionality like this, look into this code :)
The orginal code will you find in override/templates/full/images.tpl

{def $parent = $node.parent
$previous_item = false()
$next_item     = false()}
                                       
{if $parent.class_identifier|eq( 'blog' )}
                                   
{def $siblings = fetch( 'content', 'list', hash( 'parent_node_id',    $parent.node_id,
                                                                    'as_object', true(),
                                                                    'class_filter_type', 'include',
                                                                    'class_filter_array', array( 'blog_post' ),
                                                                    'sort_by',            array( 'attribute', false(),            'blog_post/publication_date' ),
                                                                                      'limit',              10000 ) )
                                          $index    = 0
                                          $node_id  = $node.node_id}
                                         
                                     {while is_set( $siblings[$index] )}
                                         {if $siblings[$index]['node_id']|eq( $node_id )}
                                             {if $index}
                                                 {set $previous_item = fetch( 'content', 'node', hash( 'node_id', $siblings[$index|dec]['node_id'] ))}
                                             {/if}
                                             {if is_set( $siblings[$index|inc] )}
                                                 {set $next_item = fetch( 'content', 'node', hash( 'node_id', $siblings[$index|inc]['node_id'] ))}
                                             {/if}
                                             {break}
                                         {/if}
                                         {set $index = $index|inc}
                                     {/while}
                                     {undef $siblings $index $node_id}

Cheers!

Nicolas Pastorino

Wednesday 29 June 2011 6:11:48 am

That is useful for others landing on this page/question. Thanks for this Sim.

Cheers,

--
Nicolas Pastorino
Director Community - eZ
Member of the Community Project Board

eZ Publish Community on twitter: http://twitter.com/ezcommunity

t : http://twitter.com/jeanvoye
G+ : http://plus.tl/jeanvoye

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu