Keyword

Adding author name in latest view of K2

  • jaj suscrip
  • jaj suscrip's Avatar Topic Author
  • Offline
  • New Member
More
13 years 8 months ago #92712 by jaj suscrip
Adding author name in latest view of K2 was created by jaj suscrip
Hi!

 

I need to display the name of the author of an article in lastest view, below the data created of the item, and before the intro text.

 

I have tried to copy the code from category_item.php into lastest_item.php, but it doesn't work.

 

<?php if($this->item->params->get('catItemAuthor')): ?>        <!-- Item Author -->        <span class="catItemAuthor">            <?php echo K2HelperUtilities::writtenBy($this->item->author->profile->gender); ?> <a href="<?php echo $this->item->author->link; ?>"><?php echo $this->item->author->name; ?></a>        </span>        <?php endif; ?>

 

What can i do?

Thank you very much in advance.

Please Log in or Create an account to join the conversation.

More
13 years 8 months ago #92713 by Terry Britton
Replied by Terry Britton on topic Adding author name in latest view of K2
See this post about adding author to generic view: community.getk2.org/forum/topics/how-to-retrieve-items-author. The same approach should work for latest view.

Please Log in or Create an account to join the conversation.

  • jaj suscrip
  • jaj suscrip's Avatar Topic Author
  • Offline
  • New Member
More
13 years 8 months ago #92714 by jaj suscrip
Replied by jaj suscrip on topic Adding author name in latest view of K2
Thank you for your reply.  I tested it yesterday, but it doesn't work for me (I am still novice in php ...)

I think the problem is the following:

k2  generic view may use a  comand like this:

index.php?option=com_k2&view=itemlist&layout=category&task=category&id=3

And k2 latest view use this:

index.php?option=com_k2&view=latest&layout=latest

So I have edited first  the following file

/components/com_k2/latest/view.html.php

 

For any reason, this did not work for lastest view or I am doing something wrong.

Thank you for your help!

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum