Uutiset:

Wondering if this will always be free?  See why free is better.

Main Menu
Advertisement:

Boolean Check for Post Topic (not reply)

Aloittaja Ice_Drake, toukokuu 26, 2014, 05:57:09 AP

« edellinen - seuraava »

Ice_Drake

Hi, I am looking for a way to check if a post is the topic (not its replies). I have no clue where or how to write up such boolean condition. I need to use it in Display.template.php for SMF 2.0.7. Thanks in advance.

margarett

Like this:

while ($message = $context['get_message']())
{

if ($message['id'] == $context['topic_first_message'])
echo 'YAY, TOPIC FIRST MESSAGE!!!';

Example result attached ;)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

LainaaOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Arantor

I'd sort of wonder what the use here is for this because that test may not be enough...
Holder of controversial views, all of which my own.


Ice_Drake

Lainaus käyttäjältä: Arantor - toukokuu 26, 2014, 11:09:13 AP
I'd sort of wonder what the use here is for this because that test may not be enough...

No, it is good enough. I have modified a mod that you can like or unlike a post to allow hate or unhate a post. I just need to let users to like or hate only the topic post, not just all posts including the replies. It was just what I needed. Thanks!

Arantor

Aside from the fact it doesn't actually enforce it and would be quite possible to hate any post...
Holder of controversial views, all of which my own.


Advertisement: