Next Item

Melih
Melih
@melih
10 years ago
198 posts
Hello everyone,

I hope you are all having a great day!

I have a question, is there a easy way to make links to get next and previous items in a page for example item_detail template?

I want to put links to easly jump to next or previous post like wordpress without going back to item_list

I know it is possible because in here your documentation pages has it, but how i don't know :)
updated by @melih: 11/03/16 11:19:41AM
brian
@brian
10 years ago
10,149 posts
This is something setup specifically in documentation that is not going to be usable by other modules. Unfortunately there is no "easy" way to do this - you could try 2 different jrCore_list calls at the bottom of the page that looks for the next/previous item (based on item_order - i.e. audio_item_order), but unless the user has arranged them correctly beforehand it would not work.


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
Melih
Melih
@melih
10 years ago
198 posts
Thank you Brian, i will try to make somethings.
michael
@michael
10 years ago
7,826 posts
The gallery module does it, look at an item_detail page on the gallery module. It does it the way brian suggested with jrCore_list calls.
Melih
Melih
@melih
10 years ago
198 posts
But unfortunately i don't have gallery module :( Coldu you just give me the jrCore_list call?
brian
@brian
10 years ago
10,149 posts
Melih:
But unfortunately i don't have gallery module Coldu you just give me the jrCore_list call?

The Gallery module does not use a jrCore_list call - it uses a custom smarty function... sorry!


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
brian
@brian
10 years ago
10,149 posts
What module are you trying to do this for?


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
Melih
Melih
@melih
10 years ago
198 posts
That's ok Brian, i made one by myself with your firts idea!

I am sharing that piece of code so it could help someone...

/// If you add this code to the item_details.tpl it will navigate you to other items of profile owner.
//Captures for Nest & Previous Links:
{capture name="template" assign="next_tpl"}
    {literal}
        {jrCore_module_url module="myModule" assign="murl"}
        {foreach $_items as $item}
            <a href='{$jamroom_url}/{$item.profile_url}/{$murl}/{$item._item_id}'>Next</a>
        {/foreach}
    {/literal}
{/capture}

{capture name="template" assign="prev_tpl"}
    {literal}
        {jrCore_module_url module="myModule" assign="murl"}
        {foreach $_items as $item}
            <a href='{$jamroom_url}/{$item.profile_url}/{$murl}/{$item._item_id}'>Previous</a>
        {/foreach}
    {/literal}
{/capture}

// If items ordered to new to old in item_list next one actually will be older one. If you are using another method to order items you can change order_by and search parameters
{jrCore_list module="jrGenStory" order_by="_item_id numerical_desc" profile_id="`$item._profile_id`" search1="_item_id < `$item._item_id`" limit="1" template=$next_tpl assign="next_link"}

{jrCore_list module="jrGenStory" order_by="_item_id numerical_asc" profile_id="`$item._profile_id`" search1="_item_id > `$item._item_id`" limit="1" template=$prev_tpl assign="prev_link"}

<div class="nextprev">
	<div style="float:right;">
		{$next_link}
	</div>
	<div style="float:left;">
		{$prev_link}
	</div>
</div>

updated by @melih: 07/28/16 02:51:26PM
brian
@brian
10 years ago
10,149 posts
Awesome - that brings a smile to my face that you just ran with it and got it working - nice job :)


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
Melih
Melih
@melih
10 years ago
198 posts
Thank you Brian! :)

I am planing to add this more than one module. But actaully firts reason is, i made a custom one to display panoramic images. It require some additional script to show. And the lightbox not allowed anyting but images. So I wanted to jump to next one easily ;)
updated by @melih: 07/28/16 03:16:15PM
SteveX
SteveX
@ultrajam
10 years ago
2,589 posts
Melih:i made a custom one to display panoramic images.

Hey, I've got one of those too! I'm using A-Frame, which route did you take?


--
¯\_(ツ)_/¯ Education, learning resources, TEL, AR/VR/MR, CC licensed content, panoramas, interactive narrative, sectional modules (like jrDocs), lunch at Uni of Bristol. Get in touch if you share my current interests or can suggest better :)
Melih
Melih
@melih
10 years ago
198 posts
I didn't see A-Frame before. It looks good and it have VR support!

I used Pannellum. Simple and easy. For now it looks enough for me. But i will examine A-Frame, vr support is tempting :)

My priority was that panoramic images would be easily uploaded by users

Tags