SOLVED - Changing 'Read More' to link to K2 Category

Free responsive Joomla 2.5 and 3.x module to present your content with easy and intuitive way.
Rate this topic: Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.
GK User
Mon Aug 29, 2011 4:03 am
Hi

I am using NSP GK4 on Financial Business, I would really like to get the read more to link thru to the item category rather than the item itself, doing it this way means the client just has to add new items to his category and they will be automatically added to the FP NSP slider but still provide a link to the category as the main_menu will be removed once the sites completed.

TheBridge.ae

I realise it's going to be a hack but a few pointers in the right direction would be great, I also realise that i could do it with a custom module but that's just repeating the input of the item not to mention the resizing of images etc.

Hope someone can help.

Cheers and TIA
User avatar
Gold Boarder

GK User
Thu Sep 01, 2011 4:40 am
Hi

OK, I have tracked down the file that generates the layout, layout.parts.php

Here is the code that needs changing (I think)

Code: Select all
   // ReadMore button generator
   function readMore_k2($config, $news_id, $news_alias, $news_cat_id, $news_cat_alias) {
      //
      require_once (JPATH_SITE.DS.'components'.DS.'com_k2'.DS.'helpers'.DS.'route.php');
      //
      if($config['news_content_readmore_pos'] != 'disabled') {
         $class = ' f'.$config['news_content_readmore_pos'];
         $link = urldecode(JRoute::_(K2HelperRoute::getItemRoute($news_id.':'.urlencode($news_alias), $news_cat_id.':'.urlencode($news_cat_alias))));
         //
         if($config['news_content_readmore_pos'] != 'after') {
            return '<a class="readon readon_class '.$class.'" href="'.$link.'">'.JText::_('NSP_READMORE').'</a>';
         } else {
            return '<a class="nsp_readmore inline" href="'.$link.'">'.JText::_('NSP_READMORE').'</a>';
         }
         
         if($config['news_content_readmore_pos'] == 'after') {
            return '<a class="nsp_readmore inline" href="'.$link.'">'.JText::_('NSP_READMORE').'</a>';
         } else {
            return '<a class="readon readon_class '.$class.'" href="'.$link.'">'.JText::_('NSP_READMORE').'</a>';
         }
         
      } else
         return '';
   }



I'm guessing that the link$ needs changing to link to the cat but I havent got a clue how to change the item link to the category link, can anyone help?

I can hard code a single category url into the links but if the client wants to add new catergories to the module thats not gonna work (and it's cheating)

TIA

Kev
User avatar
Gold Boarder

GK User
Sun Sep 04, 2011 12:40 pm
Bump...

Anyone?

I can't be the only person wanting this?? Surely?
User avatar
Gold Boarder

teitbite
Mon Sep 05, 2011 10:56 pm
Hi

In the matter of fact there were any more request of that :)

But have You tried to use %CATEGORY in additional info and enable the option that it should link to category ? Maby this will gonna work commonly.
User avatar
Moderator

GK User
Tue Sep 13, 2011 4:43 am
Hi Teitbite

Doesn't work... :(

Any ideas?
User avatar
Gold Boarder

GK User
Tue Sep 13, 2011 8:54 am
OK, got it, line 335 (in my version) change to...

$link = urldecode(JRoute::_(K2HelperRoute::getCategoryRoute($news_cat_id)));

Works like a dream :)
User avatar
Gold Boarder

teitbite
Thu Sep 15, 2011 10:46 pm
Hi

Ok. That's also a way :) Glad You've made it.
User avatar
Moderator


cron