How to get attribute of the Next/Prev page
Permalink
In blog_entry i added the "prev-next" block.
I want to create this famous "next-prev" layout (see screen shot)
[thumb] NEXT>
[thumb] <PREV
I have the link of next/prev and page names from the core block. And the design its only CSS and a little markup.
"THE PROBLEM" - i dont know how to get the thumbnail attribute of the "next" of "prev" pages (in other world how to get the correct page object)
I want to create this famous "next-prev" layout (see screen shot)
[thumb] NEXT>
[thumb] <PREV
I have the link of next/prev and page names from the core block. And the design its only CSS and a little markup.
"THE PROBLEM" - i dont know how to get the thumbnail attribute of the "next" of "prev" pages (in other world how to get the correct page object)
Are you creating a custom template for the Prev/Next block or are you creating your own custom block with similar functionality?
Similar. Custom template. I only want to change the markup
Hi siton,
I have attached a custom template for the Next & Previous block that will get the thumbnail attribute of next and previous pages. The same approach can be used to get the page description and other attributes and page information.
I have attached a custom template for the Next & Previous block that will get the thumbnail attribute of next and previous pages. The same approach can be used to get the page description and other attributes and page information.
Where i can find a code example?....thanks
@siton
You can find the code example attached to my previous reply.
You can find the code example attached to my previous reply.
Thanks it really help me. In PHP i always get error
"syntax error, unexpected 'echo' (T_ECHO), expecting ',' or ';' "
For example i want to add to your code "alt" - what wrong with this code? (look at end of the code).
Thanks
"syntax error, unexpected 'echo' (T_ECHO), expecting ',' or ';' "
For example i want to add to your code "alt" - what wrong with this code? (look at end of the code).
Thanks
<?php $previousThumbnailAttribute = $previousCollection-> getCollectionAttributeValue('thumbnail'); $alt = $previousThumbnailAttribute->getDescription(); if (is_object($previousThumbnailAttribute)) { $previousThumbnail = $ih->getThumbnail($previousThumbnailAttribute, 80, 80, true); echo '<img class="class="uk-thumbnail"" src= "' . $previousThumbnail->src . '" width="' . $previousThumbnail->width . '" height="'. $previousThumbnail->height . /*error line */ '" alt="' echo $alt '">'; //this line makes the error } ?>
you are already echoing the output so you should change that last line to:
'" alt="' .$alt. '">';
rather than using echo again
'" alt="' .$alt. '">';
rather than using echo again
If anyone needs this. I have updated the custom template that MrKDilkington so kindly created. You can use this in version 8 and up.
<?php defined('C5_EXECUTE') or die("Access Denied."); if (!$previousLinkURL && !$nextLinkURL && !$parentLabel) { return false; } if (is_object($nextCollection)) { $nextThumbnailAttribute = $nextCollection->getCollectionAttributeValue('thumbnail'); $imageNext = \Core::make('html/image', array($nextThumbnailAttribute)); $nextImg = $imageNext->getTag(); } ?> //Add this part to the specific area you need the thumbnail to display. <?php if ($nextImg) { ?> <div class="ccm-next-thumbnail"> <?php echo '<a href="' . $nextLinkURL . '">' . $nextImg . '</a>'; ?>
Viewing 15 lines of 17 lines. View entire code block.