SMF Support > SMF 2.0.x Support
Variable with body of the first message in display.template?
(1/1)
đukela:
Hi
I'm wondering if anybody knows how could I get content of the first post in a topic (display.template).
What I'm trying to do is call that text in a linkedin share button...However I cannot find the variable which catches it...
I don't know if $topicinfo array contains anything like that...Using it I can easily call subject, first message id...but body text I didn't find
The button is outside posts, before topic title and not in the posts.
All hints and suggestions are welcomed.
SMF 2.02
phantomm:
I think that if you show button in first message then you can use
--- Code: ---$message['body']
--- End code ---
to get first message content. I did the same thing in other buttons
đukela:
Yeah, I know...but it doesn't fit in so nicely inside the post...maybe I will use this as last last last resort
I think the problem comes to this:
// Get all the messages...
while ($message = $context['get_message']())
I'm putting button before this so $message['body'] has no effect
I'm experimenting now with this...trying to call it earlier just for the button
Thanks though
Arantor:
You cannot get the content of the first post before that while() statement, that's where it is physically loaded.
đukela:
Yeah,
I will leave this for now, buttons will have to suffer from imperfection a little bit :D
Thanks for replies
Navigation
[0] Message Index
Go to full version