Jump to the post that solved this thread.
Solved: 7 Years, 10 Months, 2 Weeks ago How to display something only in the first post in a thread
#1
Solved: 7 Years, 10 Months, 2 Weeks ago
How to display something like an image in the first post of a thread.

I was searching in showthread.php template and found {$first_post}. But where is the actual file linked to {$first_post} so that i can edit it.



Running Mybb 1.8
Reply
#2
Solved: 7 Years, 10 Months, 2 Weeks ago
MyBB system's showthread template by default doesn't has {$first_post} variable.
you may use XThreads plugin to use required code in the first post
Reply
#3
Solved: 7 Years, 10 Months, 2 Weeks ago
a doubt, is it possible to make use of the {$post_number} variable to check whether its the first post (post number 1) and display the content  Huh Huh
We can't help everyone, but everyone can help someone - Ronald Reagan
Did you know? Your question has already been answered. But you haven't searched it yet.
Don’t  Forget to “Mark as Solved” after the fix
Reply
#4
Solved: 7 Years, 10 Months, 2 Weeks ago
Sir, i am using Xthreads. But how to use xthread to edit the first post. I did not understand. Or if it is possible to use {$post_number) variable to display the desired thing. If yes then how.

Sir please help.
Reply
#5
Solved: 7 Years, 10 Months, 2 Weeks ago
this seems to be working....

you need PHP in Templates plugin for this to work....

add a conditional like below after the {$post['message']} in the postbit template....

{$post['message']}
</div>
<if $post_number == 1 then>
<br />
//Content to be displayed
</if> 
We can't help everyone, but everyone can help someone - Ronald Reagan
Did you know? Your question has already been answered. But you haven't searched it yet.
Don’t  Forget to “Mark as Solved” after the fix
Reply
#6
Solved: 7 Years, 10 Months, 2 Weeks ago
Many Many thanks you are awesome. Thanks a lot.

One More thing, i wanted to ask is that is there any way to extract the first image from thread and display in the forumdisplay_threadlist.
Reply
#7
Solved: 7 Years, 10 Months, 2 Weeks ago
just a note:
php in templates plugin should be used only if one has to add php code into templates
template conditionals plugin is preferred for using the conditions
Reply
#8
Solved: 7 Years, 10 Months, 2 Weeks ago
okay Sir. But, if i use php in templates plugin, will it create any problem.
Reply
#9
Solved: 7 Years, 10 Months, 2 Weeks ago
(2015-01-11, 01:34 PM)dimxo Wrote: if i use php in templates plugin, will it create any problem.

Any admins with templates edit access will be able to execute PHP in your forum. Generally, I also recommend Template Conditionals for such simple tasks.

Also, you should rather check $postcounter since it's a plain integer and $post_number is the formatted version of it: https://github.com/mybb/mybb/blob/featur...t.php#L637
Reply
#10
Solved: 7 Years, 10 Months, 2 Weeks ago
Please help. What is the syntax to check forum id. That is i want to display something in threadlist but not of all forums. Like i want to use conditional tag so that it will display in a particular forum.

Thanks in advance
Reply
Jump to the post that solved this thread.


Forum Jump:


Users browsing this thread: 1 Guest(s)