News:

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

Main Menu

Last post adjustment vb-like

Started by Black Tiger, March 07, 2014, 12:12:01 PM

Previous topic - Next topic

Black Tiger

I would like to adjust my lastpost piece so the thread title is more visible and the "posted by" is just replace with "by", because thread title is more important then the user who posted it.:)

So more like in vbulletin, see the attached screenshot.

Can anybody explain me how to do this. I'm not good at css, so if possible with a "find this" and "replace with this" kind of reply.:)
Greetings, Black Tiger

margarett

The text string is just a change in a language file (index.english.php)

What do you want to do to the post subject? Bold?
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

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

Black Tiger

The text is not the problem. I want the last thread title more fully.
Now it's something like:
QuoteLast message by L.Oosterhoff
in Re: BBC 3 alleen nog als...
Posted on 03-03-2014

And I want it more like my screenshot, so like this:
QuoteBBC3 alleen nog als FTA zender te zien
by L. Oosterhoff
03-03-2014

So thread title on top, and a little more characters of the thread title and in bold.
The below that, only "by" (or in dutch "door") and the username of the poster.
On the 3rd row, only date, but if possible aligned on the right side. Shortly said, exactly like the screenshot.

Important is that the width of the thread name gets a bit more characters then it has now so more of the thread title is viewable.
Greetings, Black Tiger

Black Tiger

I just found this in the MessageIndex.template.php and changed the lines to this:
if (!empty($board['last_post']['id']))
echo '
<p><strong>', $board['last_post']['link'], '</strong><br />
', $board['last_post']['member']['link'], '<br />
', $board['last_post']['time'],'
</p>';


So I changed the display order. However, i don't see any changes, in spite of the fact that I did a ctrl-F5 and also tried another browser.
Is this the wrong place or do I need to delete the cache from the cache directory?

And how can I put the last post time to the right side?
Greetings, Black Tiger

Illori


Black Tiger

??? There is nothing like that in display.template.php. The only thing I could find with lastpost in it was:
div class="pagelinks floatleft">', $txt['pages'], ': ', $context['page_index'], !empty($modSettings['topbottomEnable']) ? $context['menu_separator'] . ' &nbsp;&nbsp;<a href="#lastPost"><strong>' . $txt['go_down'] . '</strong></a>' : '', '</div>

and this one:
<a id="lastPost"></a>';
I don't see anything of user or date in there, so nothing to change the display order.
Greetings, Black Tiger

Illori

oh... sorry boardindex.template.php

Black Tiger

Thank you, that worked.

Now I just need the last 2 things.
1.) Where can i give the last topic title a bit more width so a few more characters of the last post title are displayed?
2.) How can set that onlyl this part:
', $board['last_post']['time'],'
will align to the rigt?
Greetings, Black Tiger

margarett

1) Subs-BoardIndex.php
$row_board['short_subject'] = shorten_subject($row_board['subject'], 24);
See the 24? Have fun :P

2) Have to check
edit:
Like this:
<div style="text-align:right;">', $txt['on'], ' ', $board['last_post']['time'],'</div>
(you probably want to remove the "on" part)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

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

Black Tiger

Thank you Margarett, you are great!

About the txt part, can I just also remove the complete txt section so it will be like this (did this also with the other adjustment):
<div style="text-align:right;">', $board['last_post']['time'],'</div>
Greetings, Black Tiger

margarett

Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

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

Black Tiger

Oh great, it worked, my love-meter for SMF is raising more and more.

Just a last question which I forgot..... Where is the "Re: topictitle", so I can remove the "Re:" part?
Greetings, Black Tiger

margarett

That's a little bit trickier...

Thing is, in SMF each post has its own subject (so different posts can have different subjects inside same topic, see what I mean?

So, there are basically 2 possibilities:
1 - Adjust the query to retrieve the topic subject (first message, that is...) and show it --> bad idea, would have a very complicated query (2 extra JOINs if I'm thinking straight) repeating itself for each board
2 - Pick that subject, search for "Re:" in the first position and replace it --> str_replace maybe?
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

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

Black Tiger

I understand. Changing subjects by users in a topic works the same as in vBulletin where I just migrated from. In their topics a user can also put a title/subject above his reply. Not that I liked that, don't see a reason to it either, but that's beside the point.:)

But that subject display part works a bit different on SMF then on vBulletin. With vB it's indeed not the last reply or subject shown there, but only the latest (newest) thread title. The user displayed is the same was with SMF the user who made the newest reply to it.
And if a user clicks on that thread title, he will be automatically taken to his last read post in that topic.

I don't quite understand the 2nd solution about the str_replace. Is that something that would make a mod necessary? Something which has to do a "search and replace" in the database every time?
Greetings, Black Tiger

margarett

Nop, it's just a string comparison, actually... It's probably the best option, actually. Or else we would need to get the first post subject from the topic which the current post belongs to :P

* margarett got lost in his own thinking ;D
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

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

Black Tiger

So is that easy to implement somehow? Because I'm a noob with coding.:)
Greetings, Black Tiger

margarett

Should be. I can give it a look, but not now as I'm off to bed, since my head is already swinging :P

Bump this tomorrow if I (or someone else) don't post something
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

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

Herman's Mixen

Quote from: Black Tiger on March 07, 2014, 07:15:44 PM
Oh great, it worked, my love-meter for SMF is raising more and more.

Just a last question which I forgot..... Where is the "Re: topictitle", so I can remove the "Re:" part?

open /themes/your-theme-name/languages/index.dutch.php or index.english.php
depends which you are using ;)

Code (find) Select
$txt['response_prefix'] = 'Re: ';

Code (change to) Select
$txt['response_prefix'] = '';

Met vriendelijke groet, The Burglar!

 House Mixes | Mixcloud | Any Intelligent fool can make things bigger, more complex, and more violent.
It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Albert Einstein

Former Godfather of our dutch community ;)

Black Tiger

Thank you Herman. It wasn't quite there, but you put me no the right trail.

It was at /Thems/default/languages/index.dutch(-utf8).php or the english version of it.

Unfortunately, removing the "Re: " from both those index files did not fix it. Checked with 2 browsers and did ctrl-F5.
Greetings, Black Tiger

Herman's Mixen

Your sure you altered the right theme ?
sometimes themes uses their own languages

Sometimes you must push CNTRL+F5 a few times ;)
Met vriendelijke groet, The Burglar!

 House Mixes | Mixcloud | Any Intelligent fool can make things bigger, more complex, and more violent.
It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Albert Einstein

Former Godfather of our dutch community ;)

Kindred

IIRC, hat you just did will stop it, going forward, however, you will also have to remove it from all saved titles in the database.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

margarett

^^ This. And, this will prevent the "Re:" to be added to new replies. Not sure if this is intended or a good idea...
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

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

Black Tiger

Yes. It's only in those two files.
I did a string search under linux console and only those 2 files containing the "Re:" came back as result.
It's like this at the moment:
$txt['response_prefix'] = '';
If you want, you can have a look for yourself. My site is in my profile if it correct.

Margarett: I did not see any "re" on new reply's anyway, and I don't mind if they are not there.:)

@Kindred: That will indeed be the cause. I presume there is no simple way to do this? Have to do it manually via phpmyadmin I guess?
Greetings, Black Tiger

Herman's Mixen

dunno if this wil work for you but you can try it if it won't change it back

open /Sources/Subs-BoardIndex.php
Code (find) Select

censorText($row_board['subject']);


Code (add before) Select

$row_board['subject'] = preg_replace('/^' . preg_quote($txt['response_prefix']) . '/', '', $row_board['subject']);
Met vriendelijke groet, The Burglar!

 House Mixes | Mixcloud | Any Intelligent fool can make things bigger, more complex, and more violent.
It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Albert Einstein

Former Godfather of our dutch community ;)

Black Tiger

It won't remove it Herman.
I will change it back. I think your previous solution will work, but only on newer threads, so from this moment on.
Greetings, Black Tiger

margarett

You need to add a link to redirect your homepage to /forum so that we don't need to copy/past it ;)

Anyway, I still think that this is not a good idea. Overall you want to know when it is a reply or not, just in BoardIndex you want to have this "Re: trimmed. But that's up to you ;)

Quote from: Black Tiger on March 08, 2014, 09:35:40 AM
It won't remove it Herman.
I will change it back. I think your previous solution will work, but only on newer threads, so from this moment on.
You are right ;)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

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

Black Tiger

Thank you all for your great help!!
Greetings, Black Tiger

margarett

Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

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

Black Tiger

Yep it worked. As soon as a new reply is posted, the "Re:" is gone.;)
Greetings, Black Tiger

Black Tiger

Little correction for future references. Herman's code was not needed. It was enough to remove the "Re: " part in the index.english.php (or other language) file.
Greetings, Black Tiger

Advertisement: