News:

Want to get involved in developing SMF? Why not lend a hand on our GitHub!

Main Menu

Titles on header

Started by Fabiolas, April 05, 2012, 12:21:00 PM

Previous topic - Next topic

Fabiolas

Hi,

I want to display current page title without "- forumname" in my forum header, but i don't know what is the php code.

Thanks in advance.

NanoSector

Can you attach your theme's index.template.php here, please?
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

Fabiolas

Quote from: Yoshi2889 on April 05, 2012, 12:26:42 PM
Can you attach your theme's index.template.php here, please?

I think that it isn't necessary.

I just tested with ', $context['page_title_html_safe'], '

But i still get "Current Page - Forum Name" and i just want "Current Page".

I'm running SMF 2.0.2.

Thanks.

Fabiolas

Solution:

You can use ', $context['page_title_html_safe'], ' but you must do some code changes.


Find in ./Sources/Display.php:$context['page_title'] = $topicinfo['subject'] . ' - '. $context['forum_name'];

Replace with:$context['page_title'] = $topicinfo['subject'];


-----------------------------

Find in ./Sources/MessageIndex.php:$context['page_title'] = strip_tags($board_info['name']) . ' - ' . $context['forum_name'];

Replace with:$context['page_title'] = strip_tags($board_info['name']);


Matthew K.

Furthermore, you could save yourself the hassle.
./Sources/Subs.php
Code (Locate) Select
$context['page_title_html_safe'] = $smcFunc['htmlspecialchars'](un_htmlspecialchars($context['page_title']));
Code (Add After) Select
$context['page_title_html_safe'] = str_replace(' - ' . $context['forum_name'], '', $context['page_title_html_safe']);
OR
Code (Locate) Select
$context['page_title_html_safe'] = $smcFunc['htmlspecialchars'](un_htmlspecialchars($context['page_title']));
Code (Add Before) Select
$context['page_title'] = preg_replace('/(.+?)\s-\s' . $context['forum_name'] . '$/i', '$1', $context['page_title']);

Advertisement: