×
Kunena 5.2 Beta 1 Released (24 Sep 2020)

The Kunena team is thrilled to announce the first public beta release of Kunena 5.2, a native Joomla extension for Joomla 3.9. This is a development release and should be only be used for testing; this version is not recommended for live websites at this stage.

The purpose of this release is to encourage testing by downloading, installing and identifying any problems or shortcomings that people may discover. K 5.2.0 B1 is stable and we are aware that people will discover defects. We encourage you to use the forum to report defects, as soon as they are discovered, so that the development team can work through the problems before the release of K 5.1 as a stable product. Reporting defects does not mean that the problems can or will be fixed. The Kunena team is looking forward to hearing your feedback on how well we have achieved our design goals.

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

More
1 year 9 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:
<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;
$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
1 year 9 months ago - 1 year 9 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.
<?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:
<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: 1 year 9 months ago by ianrispin.

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

  • Not Allowed: to create new topic.
  • Not Allowed: to reply.
  • Not Allowed: to edit your message.
Time to create page: 0.078 seconds