We'd like to keep collections separate from each other, as different people will be curating each one. At the moment when the user reaches the last image in a collection they can press Next and go to the first image in the next collection. I understand that this is how the system is supposed to work, but does anyone know a hack that could remove that link if the image in question is the last in a collection? And similarly for the first image in a collection - remove the choice to go to a previous image.
Alternatively, is there a way to make it obvious when the user moves from one collection to another?
Thanks for any help.
This is a fairly straightforward alteration to whatever theme you are using. Go to the /themes/YourTheme/items/show.php file, and look for these lines:
<ul class="item-pagination navigation">
<li id="previous-item" class="previous"><?php echo link_to_previous_item(); ?></li>
<li id="next-item" class="next"><?php echo link_to_next_item(); ?></li>
</ul>
And delete them.
If your theme does not have an /items directory, or if there isn't a show.php file, do the following:
If the /items directory is not in your theme, create it. Then go to /application/views/scripts/items directory, and copy the show.php file into the items directory in your theme. Then make the modifications above.
Good luck!
Sorry, just realized you probably want to _only_ remove those links when the next or previous item would take you to a new collection. What I have above removes those links completely.
Here's roughly what might work -- haven't tested it. Instead of getting rid of the links completely, this tries to check:
<?php
//dig up the current item, next and previous items, and the collection for the current item
$item = get_current_item();
$next = $item->next();
$previous = $item->previous();
$collection = get_collection_for_item($item);
?>
<ul class="item-pagination navigation">
<?php if( item_belongs_to_collection($collection->name, $previous): ?>
<li id="previous-item" class="previous"><?php echo link_to_previous_item(); ?></li>
<?php endif; ?>
<?php if( item_belongs_to_collection($collection->name, $next): ?>
<li id="next-item" class="next"><?php echo link_to_next_item(); ?></li>
<?php endif; ?>
</ul>
Thanks very much. I will give it a try and report back.
Thanks for the code. Unfortunately it didn't work. I got the following message:
Parse error: syntax error, unexpected ':' in .../themes/deco/items/show.php on line 226
which is <?php if(item_belongs_to_collection($collection->name, $previous): ?>
Hope it's easy to fix, but I have to learn PHP first so if you can give a pointer what to fix that would be great.
Thanks
My bad...missing a ) this should be happier:
<?php if(item_belongs_to_collection($collection->name, $previous)): ?>
probably same in the code for $next
Thanks for the help. This was going to be a short post to say thanks, I think you've done it! It certainly worked for the images that were already in the collections. But oddly - when I added more images to a collection using the DROPBOX plugin, say adding image 4 and image 5 to a collection that did only have 3 images - the link on image 3 remained as just PREVIOUS, without the option to go on and view the recently added images.
I have experimented with new collections and adding different images to collections and it seems to be: Your links work perfectly with items I had already uploaded before I
Could it have been using dropbox to upload that has messed it up? I have disabled it and still the problem persists.
Do you have any suggestions?
Many thanks.
huh. I wouldn't have thought it was something with Dropbox. Do you have a public link to those pages?
Also, could you copy-paste in exactly the code that you now have in that items/show.php file?
Thanks!
Hello Folks
I thought I might ask if anyone knows if this solution really worked? The OP never responded.
Thanks Much