Uutiset:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu
Advertisement:

Removing Re in Boardindex.template.php

Aloittaja Biology Forums, toukokuu 26, 2011, 01:58:25 IP

« edellinen - seuraava »

Biology Forums

Using 1.1.13, how do I remove that re: etcetc... I just want the title without the Re...


MrGrumpy

Easy way to do it is to edit the text string for it, I can't tell you exactly what to edit as I don't use 1.1.13 but you need to look in index.english.php and search for

'Re: ';

In 2.0 it the text string looks like

$txt['response_prefix'] = 'Re: ';

It will probably be a bit different in your version but the Re: part will be the same

Change the

'Re: ';

To

' ';





the possession of knowledge is worthless unless imparted upon others
My Custom Themes
2.0 themes only - I don't do 1.1.x

Sir Osis of Liver


No, that won't work.  The 'Re:' is included in the variable $board['last_post']['link'].  Have to find where that variable is put together.

When in Emor, do as the Snamors.
                              - D. Lister

Sir Osis of Liver

#3
Ok, here's a workaround -

In BoardIndex.template.php

Find this:



/* The board's and children's 'last_post's have:
time, timestamp (a number that represents the time.), id (of the post), topic (topic id.),
link, href, subject, start (where they should go for the first unread post.),
and member. (which has id, name, link, href, username in it.) */
if (!empty($board['last_post']['id']))
echo '
<b>', $txt[22], '</b>  ', $txt[525], ' ', $board['last_post']['member']['link'] , '<br />
', $txt['smf88'], ' ', $board['last_post']['link'], '<br />
', $txt[30], ' ', $board['last_post']['time'];




Change it to this:



/* The board's and children's 'last_post's have:
time, timestamp (a number that represents the time.), id (of the post), topic (topic id.),
link, href, subject, start (where they should go for the first unread post.),
and member. (which has id, name, link, href, username in it.) */
if (!empty($board['last_post']['id']))

$board['last_post']['link'] = str_replace('Re: ', '', $board['last_post']['link']);

echo '
<b>', $txt[22], '</b>  ', $txt[525], ' ', $board['last_post']['member']['link'] , '<br />
', $txt['smf88'], ' ', $board['last_post']['link'], '<br />
', $txt[30], ' ', $board['last_post']['time'];





When in Emor, do as the Snamors.
                              - D. Lister

Biology Forums

krash, Worked like a Charm, thankS! Thanks to everyone else too!

Matthew K.

Actually, a str_replace(); isn't the smartest move in this case. A preg_replace(); is the best option for this case since "Re:" could be used in other positions beyond the start of the string.

I do believe there are multiple mods for this...

Sir Osis of Liver

Lainaus käyttäjältä: Labradoodle-360 - toukokuu 26, 2011, 05:56:45 IP
Actually, a str_replace(); isn't the smartest move in this case. A preg_replace(); is the best option for this case since "Re:" could be used in other positions beyond the start of the string.

Thought of that after I got off.  Can't make preg_replace do what I want.  This should work, but doesn't.


$board['last_post']['link'] = preg_replace('/Re: /', '', $board['last_post']['link'], 1);


With no limit parameter, or limit = -1, it replaces all occurences of 'Re: '.  With limit = 1, it doesn't replace any.



When in Emor, do as the Snamors.
                              - D. Lister

Advertisement: