News:

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

Main Menu

Page Number in Titles

Started by Rohan_, March 29, 2011, 01:33:42 AM

Previous topic - Next topic

Rohan_

Hello,

Currently when we browse different pages of any board or any topic the title in browser is still the same as original..

is it possible to add page 2, page 3 in the titles which appears on browsers title (no changes in url) ?

for example

currently if there is a board Jokes and it have 30 pages. and we are on any page the title is same all the time. but I want if i am on page 5 the title of the page should be this

Jokes - Page 5

not only Jokes on all pages... is it possible ?? Please help
Proud To Be An Indian

Illori

sounds like you may want to look into one of the url rewrite mods, although some of them have been known to cause issues.

Rohan_

i am using pretty urls :( does it cause any issues ?
Proud To Be An Indian

Illori

many people have reported things not working correctly since installing pretty urls, so yes it does cause issues and has little to no benefit.

Kays

Hey, try this. It should work with pretty urls.

In Sources Subs, look for:


return $pageindex;


and add before it:


global $context;
$context['page_number'] = $start / $num_per_page + 1;


Then in Index.template.php of your theme look for:


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


And replace it with:


<title>', $context['page_title'], isset($context['page_number']) ? ' [Page ' . $context['page_number'] . ']' :'', '</title>';


It's not too language freindly, so translate "Page" if your forum is not in English


If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

Rohan_

#5
hello,

yes it worked.. but need some changes...

I don't want that to be displayed on page 1... page 1 should be only board's name

when the page is displayed like Board [Page 2]

i want a dash before that page thing and don't want those brackets so it will be like this

Board - Page 2

please help :)
Proud To Be An Indian

Kays

In Index.template.php revert the code back to how it was. Now right at the top of that function, look for:


// Show right to left and the character set for ease of translating.


And add before it:


if (isset($context['page_number']))
if ($context['page_number'] != 1)
$context['page_title'] .= ' - Page ' . $context['page_number'];


One thing I forgot to mention is that this will show like that for everywhere that a page index is created.

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

Rohan_

Done... Working great now..

can you clear me what does this actually mean ?

"this will show like that for everywhere that a page index is created"

I am little confused. by that you mean everywhere in boards, topics etc. etc. ?? well that's not a problem I wanted it like that :)

Thank you so much for helping and solving this :)
Proud To Be An Indian

Kays

Quote
I am little confused. by that you mean everywhere in boards, topics etc. etc. ?? well that's not a problem I wanted it like that :)

Cool, since that's how it will work. Member list, PMs and anywhere else that Pages 1 [2] etc is shown. :)

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

Advertisement: