News:

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

Main Menu

Help - Want To Remove The "Re:" Titles In Posts

Started by brandonroy, April 06, 2011, 09:10:18 PM

Previous topic - Next topic

brandonroy

I want to remove the "Re:" titles in all replies to a thread, but not on the original thread post. The screenshot is below

Help!?




Hj Ahmad Rasyid Hj Ismail

You just need to modify your Display.template.php file to do that. If you are not sure, attach you file here.

kat

In index.english.php, find this line:

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

and change it to:

$txt['response_prefix'] = '';


Illori

that is one way to do it, although i am not sure that is the best way to fix this issue.

MLM

Try this (if you edited the display template already try to figure it out but just post again with it attached so i can look at it.

FIND: (Display.template.php)

// Done with the information about the poster... on to the post itself.
echo '
</ul>
</div>
<div class="postarea">
<div class="flow_hidden">
<div class="keyinfo">
<div class="messageicon">
<img src="', $message['icon_url'] . '" alt=""', $message['can_modify'] ? ' id="msg_icon_' . $message['id'] . '"' : '', ' />
</div>
<h5 id="subject_', $message['id'], '">
<a href="', $message['href'], '" rel="nofollow">', $message['subject'], '</a>
</h5>
<div class="smalltext">&#171; <strong>', !empty($message['counter']) ? $txt['reply_noun'] . ' #' . $message['counter'] : '', ' ', $txt['on'], ':</strong> ', $message['time'], ' &#187;</div>
<div id="msg_', $message['id'], '_quick_mod"></div>
</div>';


REPLACE:

// Done with the information about the poster... on to the post itself.
$subject_display_count = 0;
echo '
</ul>
</div>
<div class="postarea">
<div class="flow_hidden">
';
if($subject_display_count == 0)
{
echo '
<div class="keyinfo">
<div class="messageicon">
<img src="', $message['icon_url'] . '" alt=""', $message['can_modify'] ? ' id="msg_icon_' . $message['id'] . '"' : '', ' />
</div>
<h5 id="subject_', $message['id'], '">
<a href="', $message['href'], '" rel="nofollow">', $message['subject'], '</a>
</h5>
<div class="smalltext">&#171; <strong>', !empty($message['counter']) ? $txt['reply_noun'] . ' #' . $message['counter'] : '', ' ', $txt['on'], ':</strong> ', $message['time'], ' &#187;</div>
<div id="msg_', $message['id'], '_quick_mod"></div>
</div>
';
}

$subject_display_count++;

My Themes:

My Mods:

Unsolved Threads:
  • None atm...

Masterd

Quote from: K@ on April 08, 2011, 03:10:27 PM
In index.english.php, find this line:

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

and change it to:

$txt['response_prefix'] = '';

This can generate some errors, because string will be empty.


Masterd


kat

Saying "It's not good", without supplying an explanation is about as much use as a pork pie in a synagogue.

From what I can tell, $txt['response_prefix'] = 'Re: ';  only appears there, so...

Illori

how about we move this to coding discussion and see if one of the coders can comment on if that is a good or bad way to do this. it is not really a graphical change anyway so this board does not really fit this topic.

kat

I rarely notice where a topic is, to be honest.

Hj Ahmad Rasyid Hj Ismail

Quote from: K@ on April 09, 2011, 10:25:05 AM
Saying "It's not good", without supplying an explanation is about as much use as a pork pie in a synagogue.

From what I can tell, $txt['response_prefix'] = 'Re: ';  only appears there, so...
+1


Though I'd prefer the $txt['response_prefix'] to be removed from the template, this is one of the way to solve it, unless as suggested error(s) occur due to removing it in language file or template file.

Arantor

QuoteThough I'd prefer the $txt['response_prefix'] to be removed from the template

If you can remove it from the basic SMF install's templates, you are a better man than I, since I can't even find it in the templates. I *can* find the $context version, however.

Hj Ahmad Rasyid Hj Ismail

I haven't check it as I guess it should be there in the template file, though it could be in the source file instead. I think I manage to remove it in one of my mod where I arrange the poster information to the top. Let me check that just to make sure how it can be done other than via the language file.

Arantor

Quote from: ahrasis on April 09, 2011, 09:56:39 PM
I haven't check it as I guess it should be there in the template file, though it could be in the source file instead. I think I manage to remove it in one of my mod where I arrange the poster information to the top. Let me check that just to make sure how it can be done other than via the language file.

It isn't in the template. It's loaded specifically from the forum default language, rather than the user's own language, and is stored in $context as well as being a cache item for this reason.

Just removing the $txt (nor $context) won't solve for existing items in the DB, though it will new existing items.


*shrug* Then again, what do I know about it all? Have fun removing it from the template.

Hj Ahmad Rasyid Hj Ismail

#17
I already agreeable to K@ except that I think it can somehow be done within the template itself without touching the language file. But after a deeper look I guess Arantor is right. There is nothing in the template which can remove the Re: in the title of a post. As I also prefer not to modify the source file, I guess the best is to modify the language file as K@ suggested.

However, revisiting the OP again, the OP might not require just the removal of Re: but the whole line of tittle in post including the post icon that is if the images he shown is what he really intended and not only what is stated in the OP title.

I think he can use this as a solution to remove that. Find:
// Done with the information about the poster... on to the post itself.
echo '
</ul>
</div>
<div class="postarea">
<div class="flow_hidden">
<div class="keyinfo">
<div class="messageicon">
<img src="', $message['icon_url'] . '" alt=""', $message['can_modify'] ? ' id="msg_icon_' . $message['id'] . '"' : '', ' />
</div>
<h5 id="subject_', $message['id'], '">
<a href="', $message['href'], '" rel="nofollow">', $message['subject'], '</a>
</h5>
<div class="smalltext">&#171; <strong>', !empty($message['counter']) ? $txt['reply_noun'] . ' #' . $message['counter'] : '', ' ', $txt['on'], ':</strong> ', $message['time'], ' &#187;</div>
                                                      <div id="msg_', $message['id'], '_quick_mod"></div>

                                                </div>';

Change to:
// Done with the information about the poster... on to the post itself.
echo '
</ul>
</div>
<div class="postarea">
<div class="flow_hidden">
<div class="keyinfo">';
                        if ($message['id'] == $context['first_message'])
      echo '
                           <div class="messageicon">
                              <img src="', $message['icon_url'] . '" alt=""', $message['can_modify'] ? ' id="msg_icon_' . $message['id'] . '"' : '', ' />
                           </div>';
      echo '
                           <div class="messageicon">
                           </div>
                           <h5 id="subject_', $message['id'], '">
                              <a href="', $message['href'], '" rel="nofollow">', empty($message['counter']) ? $message['subject'] : '', '</a>
                           </h5>
                           <div class="smalltext">&#171; <strong>', !empty($message['counter']) ? $txt['reply_noun'] . ' #' . $message['counter'] : '', ' ', $txt['on'], ':</strong> ', $message['time'], ' &#187;</div>
                                                      <div id="msg_', $message['id'], '_quick_mod"></div>

                                                </div>';


It works when I tested it but may need some more testing to be sure. To OP good luck and to others, thanks for sharing knowledge and experience.

Hj Ahmad Rasyid Hj Ismail

Quote from: K@ on April 09, 2011, 10:25:05 AM
Saying "It's not good", without supplying an explanation is about as much use as a pork pie in a synagogue.

From what I can tell, $txt['response_prefix'] = 'Re: ';  only appears there, so...
I has detected that  $txt['response_prefix'] = 'Re: '; appears elsewhere too i.e. in Board Index and Message Index. There is also a mod that can remove that in Board Index and Message Index but not in the Post / Display page. The mod can be find here: http://custom.simplemachines.org/mods/index.php?mod=2172

I am attempting to create a mod to remove Re: in the Post / Display page and hope it will work on all language without having to modify language file.

Arantor

How about removing it from where it's defined in $context['response_prefix'], which I've hinted at twice now.

And you still have to figure out how to remove it from all the existing posts too...

Hj Ahmad Rasyid Hj Ismail

I did look at it after you hinted it out but I cannot make it work by simply removing it. In fact $context['response_prefix'] is made equal to $txt['response_prefix'] in Display.php. I have to look around more on this to make it work. Thanks for the ideas. I will try to see to it in various angle then.

Arantor

QuoteIn fact $context['response_prefix'] is made equal to $txt['response_prefix'] in Display.php

So... how about setting it to '' AFTER it's otherwise set based on $txt, hmm?

brandonroy

Quote from: ahrasis on April 09, 2011, 11:50:48 PM
I already agreeable to K@ except that I think it can somehow be done within the template itself without touching the language file. But after a deeper look I guess Arantor is right. There is nothing in the template which can remove the Re: in the title of a post. As I also prefer not to modify the source file, I guess the best is to modify the language file as K@ suggested.

However, revisiting the OP again, the OP might not require just the removal of Re: but the whole line of tittle in post including the post icon that is if the images he shown is what he really intended and not only what is stated in the OP title.

I think he can use this as a solution to remove that. Find:
// Done with the information about the poster... on to the post itself.
echo '
</ul>
</div>
<div class="postarea">
<div class="flow_hidden">
<div class="keyinfo">
<div class="messageicon">
<img src="', $message['icon_url'] . '" alt=""', $message['can_modify'] ? ' id="msg_icon_' . $message['id'] . '"' : '', ' />
</div>
<h5 id="subject_', $message['id'], '">
<a href="', $message['href'], '" rel="nofollow">', $message['subject'], '</a>
</h5>
<div class="smalltext">« <strong>', !empty($message['counter']) ? $txt['reply_noun'] . ' #' . $message['counter'] : '', ' ', $txt['on'], ':</strong> ', $message['time'], ' »</div>
                                                      <div id="msg_', $message['id'], '_quick_mod"></div>

                                                </div>';

Change to:
// Done with the information about the poster... on to the post itself.
echo '
</ul>
</div>
<div class="postarea">
<div class="flow_hidden">
<div class="keyinfo">';
                        if ($message['id'] == $context['first_message'])
      echo '
                           <div class="messageicon">
                              <img src="', $message['icon_url'] . '" alt=""', $message['can_modify'] ? ' id="msg_icon_' . $message['id'] . '"' : '', ' />
                           </div>';
      echo '
                           <div class="messageicon">
                           </div>
                           <h5 id="subject_', $message['id'], '">
                              <a href="', $message['href'], '" rel="nofollow">', empty($message['counter']) ? $message['subject'] : '', '</a>
                           </h5>
                           <div class="smalltext">« <strong>', !empty($message['counter']) ? $txt['reply_noun'] . ' #' . $message['counter'] : '', ' ', $txt['on'], ':</strong> ', $message['time'], ' »</div>
                                                      <div id="msg_', $message['id'], '_quick_mod"></div>

                                                </div>';


It works when I tested it but may need some more testing to be sure. To OP good luck and to others, thanks for sharing knowledge and experience.

You're correct.. I do want to completely remove the information there all together and not just the Re:

I used your code and it removed it, but it added the post information, for example: "« Reply #1 on: April 06, 2011, 06:46:36 PM »" to each of the posts. I want to completely remove the information there all together. It also made the report to moderator and ip address info move to the center of the post..


brandonroy

#23
Ok... If I remove this:

                         <div class="messageicon">
                              <img src="', $message['icon_url'] . '" alt=""', $message['can_modify'] ? ' id="msg_icon_' . $message['id'] . '"' : '', ' />
                           </div>
                           <h5 id="subject_', $message['id'], '">
                              <a href="', $message['href'], '" rel="nofollow">', $message['subject'], '</a>
                           </h5>


Then it works.. But doing this also takes the thread title form the first post, which I wanted to keep..

Hj Ahmad Rasyid Hj Ismail

I noticed that you are not using default theme. What is your theme? Or better, can you attach your theme original Display.template.php? It is easier for me to see how to remove it cleanly from second post and onward that way.


Moskis

Quote from: K@ on April 08, 2011, 03:10:27 PM
In index.english.php, find this line:

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

and change it to:

$txt['response_prefix'] = '';

Hi,

I've done this and works fine for me, thanks K@.

The only issue is it only stops RE: from being added to new replies.

My question is, does this SQL code look like a good idea to remove Re: from current message titles or maybe i should leave old messages alone? Seems good to me but maybe someone know of a better way. :) If it makes any difference the smf_messages table has about 10.000 rows in my case.

UPDATE msf_messages SET subject = REPLACE(subject,'RE:','');

Antechinus

Quote from: Masterd on April 09, 2011, 09:30:49 AM
Quote from: K@ on April 08, 2011, 03:10:27 PM
In index.english.php, find this line:

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

and change it to:

$txt['response_prefix'] = '';

This can generate some errors, because string will be empty.

If you are worried about that, you could always change the string to '&nbsp;';

That will still look ok, and will take up less space that the standard Re:

Hj Ahmad Rasyid Hj Ismail

It's fine with me if you cannot share your theme name or Display.template.php. If you are using default, you can try this, find:
// Done with the information about the poster... on to the post itself.
echo '
</ul>
</div>
<div class="postarea">
<div class="flow_hidden">
<div class="keyinfo">
<div class="messageicon">
<img src="', $message['icon_url'] . '" alt=""', $message['can_modify'] ? ' id="msg_icon_' . $message['id'] . '"' : '', ' />
</div>
<h5 id="subject_', $message['id'], '">
<a href="', $message['href'], '" rel="nofollow">', $message['subject'], '</a>
</h5>
<div class="smalltext">&#171; <strong>', !empty($message['counter']) ? $txt['reply_noun'] . ' #' . $message['counter'] : '', ' ', $txt['on'], ':</strong> ', $message['time'], ' &#187;</div>
                                                      <div id="msg_', $message['id'], '_quick_mod"></div>

                                                </div>';

Change to:
// Done with the information about the poster... on to the post itself.
echo '
</ul>
</div>
<div class="postarea">
<div class="flow_hidden">
<div class="keyinfo">';
if ($message['id'] == $context['first_message'])
{
echo '
<div class="messageicon">
<img src="', $message['icon_url'] . '" alt=""', $message['can_modify'] ? ' id="msg_icon_' . $message['id'] . '"' : '', ' />
</div>
<h5 id="subject_', $message['id'], '">
<a href="', $message['href'], '" rel="nofollow">', $message['subject'], '</a>
</h5>
<div class="smalltext">&#171; <strong>', !empty($message['counter']) ? $txt['reply_noun'] . ' #' . $message['counter'] : '', ' ', $txt['on'], ':</strong> ', $message['time'], ' &#187;</div>';
}
echo '
<div id="msg_', $message['id'], '_quick_mod"></div>
</div>';


Good luck!

Hj Ahmad Rasyid Hj Ismail

Quote from: Moskis on May 05, 2011, 05:54:06 PM
Quote from: K@ on April 08, 2011, 03:10:27 PM
In index.english.php, find this line:

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

and change it to:

$txt['response_prefix'] = '';

Hi,

I've done this and works fine for me, thanks K@.

The only issue is it only stops RE: from being added to new replies.

My question is, does this SQL code look like a good idea to remove Re: from current message titles or maybe i should leave old messages alone? Seems good to me but maybe someone know of a better way. :) If it makes any difference the smf_messages table has about 10.000 rows in my case.

UPDATE msf_messages SET subject = REPLACE(subject,'RE:','');
You may want to try this mod: http://custom.simplemachines.org/mods/index.php?mod=3004

Advertisement: