SMF- Show Page Number In Thread Title

Image frame
SMF- Show Page Number In Thread Title
Maruf
Sep 16th, 2009
Maruf scribbled this post.

My God, I’ve only just recently started playing around with SM Forums, and I can honestly say the documentation is God awful. At least, it’s terrible compared to Wordpress. Also, it’s not coded that great- even applying the simpliest of features require plugins (“mods”, as the SMF community call them) and/or hacks.

Anyways, in this case, I wanted to show the page number of the thread in the page title to avoid duplicate title tags. I searched high and low for a few hours, and there is extremely tedious and ridiculous solutions floating around. Someone has even created a plugin (mod package) to apply this feature. To me, that seems a bit O.T.T. You shouldn’t need to install a mod to apply such a simple feature, right? Right. So, this is my solution…

How to show page number in the thread title

Open the file index.template.php, it should be located in the theme folder of whichever theme you’re using.

Search for the following 2 line:

1
2
	// ]]></script>
	<title>', $context['page_title'], '</title>';

Replace it with:

1
2
3
4
5
6
7
8
9
  // ]]></script>';
  if($context['page_info']['current_page'] > 1) 
  { 
    echo "<title>" . $context['page_title'] . " [Page " . $context['page_info']['current_page'] . "]</title>"; 
  } 
  else 
  { 
    echo "<title>" . $context['page_title'] . "</title>"; 
  }

Save changes, upload the file.
It’s as simple as that.

Lord only know why there’s so much static noise over this issue.

If anyone tries this, please let me know how you get on.


feel free to leave a scribble

Name:
Email:
gravatar
What an image next to your comments?
visit gravatar.com
Message:
want a website, do ya?

latest projects

Image frame
RG Active
view site- RG Active
Image frame
Property Investment Project
view site- Property Investment Project

latest scribbles

latest comments

zurin Gravatar frame
zurin said
hi, i’m having problem with this function. it works fine...
Karlos Gravatar frame
Karlos said
Awesome awesome awesome :) Just started re-designing...
satheesh Gravatar frame
satheesh said
It solved my problem. Thank you. Is it possible to get the...

blog categories

Get a free quote