Problems, need help? Have a tip or advice? Post it here.
6 posts Page 1 of 1
Hello, I am able to show the title of the Next and Previous posts using this code:
Code: Select all
  <cms:php>
                  global $CTX;
                  $page_ids = explode( ",", "<cms:pages ids_only='1' />" );
                  $cur_page_id = "<cms:show k_page_id />";
                 $pos = array_search( $cur_page_id, $page_ids );
                  if( $pos!==FALSE ){
                  if( $pos>0 ){
                     // Prev page id
                     $prev_page_id = $page_ids[$pos-1];
                     $CTX->set( 'prev_page_id', $prev_page_id, 'global' );
                  }
                  if( $pos<count($page_ids)-1 ){
                     // Next page id
                     $next_page_id = $page_ids[$pos+1];
                    $CTX->set( 'next_page_id', $next_page_id, 'global' );
                  }
                  }
            </cms:php>
            <cms:if prev_page_id >
                  <cms:pages id=prev_page_id skip_custom_fields='1'>
                  <a href="<cms:show k_page_link />"><i class="fa fa-angle-left"></i> <cms:get_custom_field 'text_for_previous_article' masterpage='globals.php' /></a>
                  </cms:pages>
            </cms:if>
            <cms:if next_page_id >
              <cms:pages id=next_page_id skip_custom_fields='1'>
                  <a href="<cms:show k_page_link />"><cms:get_custom_field 'text_for_next_article' masterpage='globals.php' /> <i class="fa fa-angle-right"></i></a>
               </cms:pages>
            </cms:if>

Now I want to be able to show the Title, Image of post and an excerpt of the next or previous posts as seen in the image below:
Bottom of news page.jpg
Bottom of news page.jpg (244.74 KiB) Viewed 1149 times
.
How do I go about it? Thanks in advance
Hi,

In the mentioned solution you'll find two blocks of <cms:pages> (one for previous page and the other for next).
Please remove the skip_custom_fields='1' directive from both. Now all your custom fields (editable regions) will be available for use within those two blocks as per usual.

Hope it helps.
Thanks KK. Will try that out and let you know the outcome. :D
Yeeeeeeepeee, KK it worked Thanks so much
Hi KK,
I tried doing this to show a thumbnail of the next news item but its caused my page to disappear:
Code: Select all
<cms:if prev_page_id >
                  <cms:pages id=prev_page_id skip_custom_fields='1'>
                  <a href="<cms:show k_page_link />"><i class="fa fa-angle-left"></i> <cms:show k_page_title />
<img class="post-nav-img" src="<cms:thumbnail featured_img width='82' height='57' />" alt="" >
</a>
                  </cms:pages>
            </cms:if>

Can you please point me in the right direction? Thank you
Hi,

It seems PHP is running out of memory while trying to create the thumbnail.
Please try upping the limit a bit - find line 49 in 'couch/includes/timthumb.php' and change the following value from 64M to 128M or 256M
Code: Select all
ini_set('memory_limit', "64M");

Hope it helps.
6 posts Page 1 of 1
cron