Kunena 6.2.5 & module Kunena Latest 6.0.7 released

The Kunena team has announce the arrival of Kunena 6.2.5 [K 6.2.5] which is now available for download as a native Joomla extension for J! 4.3.x/4.4.x/5.0.x. This version addresses most of the issues that were discovered in K 6.1 / K 6.2 and issues discovered during the last development stages of K 6.2

Solved Solved: Show first post text in category view list of posts

More
5 years 2 months ago #1 by ianrispin
When viewing a category or latest posts or any list of posts...

I would like to show a snippet of the first post message text below the topic title.

This same snippet is already shown in the tooltip - I just think it would look nice if it is shown below the topic title as part of the row for that topic.

I cannot find a config option to do this.

So i am setting about modding the template.

I know I have to edit

my_template/layouts/topic/row/default.php

I know where to make the edit - just after:
Code:
<div class="started"> <span class="ktopic-category"> <?php echo Text::sprintf('COM_KUNENA_CATEGORY_X', $this->getCategoryLink($this->topic->getCategory(), null, $this->topic->getCategory()->description, KunenaTemplate::getInstance()->tooltips())) ?></span> <br/>

But i cannot figure out what variable to display to show the message.

I have tried;
Code:
$message->displayField('message');

But it doesnt work i guess cos at that point in code the item being referenced is the topic not the message.

Can anyone help?

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

More
5 years 2 months ago - 5 years 2 months ago #2 by ianrispin
Just managed to get this working.

If anyone else is interested - here is the code you need to add to your template to show the first message text.
Code:
<?php $this->message = KunenaForumMessageHelper::get($this->topic->first_post_id); echo $this->message->displayField('message'); ?>

Of course you then may wish to format to your preference.

I put it in this template: my_template/layouts/topic/row/default.php

It goes in the code like this:
Code:
<div class="started"> <span class="ktopic-category"> <?php echo Text::sprintf('COM_KUNENA_CATEGORY_X', $this->getCategoryLink($this->topic->getCategory(), null, $this->topic->getCategory()->description, KunenaTemplate::getInstance()->tooltips())) ?></span> <br/> <?php $this->message = KunenaForumMessageHelper::get($this->topic->first_post_id); echo $this->message->displayField('message'); ?>
Last edit: 5 years 2 months ago by ianrispin.

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

Time to create page: 0.643 seconds