I'm probably not the only one who has noticed this, but regular installs of SMF seem to often have an unclear title.
The title will be something along the lines of "Start new topic", or just the title of that particular thread.
Personally, I prefer seeing the title of my board in front of the topic title, to avoid confusion between different boards.
So, I'll show you the trick to doing that, right here.
Remember to ALWAYS make backups of the files you are modifying!
Open: index.template.php of the theme you are using.
If it's not there, Copy that file from SMF/Themes/default/languages/ to the languages directory of the theme you are using.
Find:
<title>', $context['page_title'], '</title>';
Replace with:
<title>', $context['forum_name'], ' - ', $context['page_title'], '</title>';
Custom board title
You've just added ', $context['forum_name'], ' - in front of your title, which is the name of your board. If you prefer having some other custom text there, this would be the place to put it.
The problem now is that the index of your forum is going to have something like "My community - My community - Index" as a title. This is easily fixed through the language files.
Copy: Forum/Themes/default/languages/index.*language*.php to the languages directory of the theme you are using, to avoid losing these modifications when updating.
Open: index.*language*.php
Find:
$txt[18] = $context['forum_name'] . ' -
Remove: $context['forum_name'] . ' -
Now, if everything went well, the name of your forum should be visible in the title on every page of your forum, and the title of your boardindex should be a single title :).
thanks a lot!
Why not just add it in the front of the <title> element in the index template?
-[Unknown]
I did :P
I read the bottom part and didn't see why you wanted to mess with the language strings... never mind, I suppose. Not sleeping enough.
-[Unknown]
That was exactly what I needed for my forums :). One Problem: on the index page of my forums, the title is OI Forums - OI Forums. How can that be fixed, or can it?
-Dan The Man
lol
Read the second part of the post :D
Zitat von: Burpee in Mai 02, 2005, 07:43:07 VORMITTAG
lol
Read the second part of the post :D
D'oh! I'm sorry. I didn't even see that there. I feel like such a n00b :P. Thank you.
-Dan The Man
ZitatOpen: index.*language*.php
The SMFOne theme doesn't include that file :-\. So that file's not there, which file should I edit?
-Dan The Man
Copy over index.english.php from Themes/default/languages to Themes/<smf one directory>/languages and edit that :)
Zitat von: Kirby in Mai 04, 2005, 12:59:29 VORMITTAG
Copy over index.english.php from Themes/default/languages to Themes/<smf one directory>/languages and edit that :)
Oh is
that what it was telling me to do? This is the second time I've made myself look like a complete n00b in ONE THREAD :P. Sorry about that. Thanks.
-Dan The Man
Don't worry, the second time was my fault for not explaining it properly :)
I just tried this today. I followed these steps and used
', $context['forum_name'] , ': but, on my board index page (the homepage), I get
ZitatAUW FORUMS:
I'm hoping for
ZitatAUW FORUMS
Did I not do this correctly or is the ':' supposed to show up?
Thanks much.
Zitat von: anunlike in Juni 26, 2005, 06:29:44 VORMITTAG
I just tried this today. I followed these steps and used
', $context['forum_name'] , ':
but, on my board index page (the homepage), I get
ZitatAUW FORUMS:
I'm hoping for
ZitatAUW FORUMS
Did I not do this correctly or is the ':' supposed to show up?
Thanks much.
To remove the colan, use the following:
', $context['forum_name'] , '
Thanks. Yes, I understand that, I should've clarified. However, I want the colon to show up whenever I'm on any page other than the board index page. In this instance, I'm using it to replace the ' - (dash) '. But, It still shows up on my board index page. I'm wondering if it's possible using this method (or something similar) to keep it for all the other forums pages but not have it show on the board index page.
I suppose I'm just overlooking something.
Wow, this code totally torched my index.template.php file. :(
Zitat von: Isaac in Juni 28, 2005, 05:58:05 NACHMITTAGS
Wow, this code totally torched my index.template.php file. :(
Worked fine for me...
-Dan The Man
Zitat von: Isaac in Juni 28, 2005, 05:58:05 NACHMITTAGS
Wow, this code totally torched my index.template.php file. :(
I really can't imagine how...
Zitat von: anunlike in Juni 26, 2005, 01:12:08 NACHMITTAGS
Thanks. Yes, I understand that, I should've clarified. However, I want the colon to show up whenever I'm on any page other than the board index page. In this instance, I'm using it to replace the ' - (dash) '. But, It still shows up on my board index page. I'm wondering if it's possible using this method (or something similar) to keep it for all the other forums pages but not have it show on the board index page.
I suppose I'm just overlooking something.
Seems to me like you already fixed it on your forum? I do believe it makes more sense to lable the front page with something like "Home" or "Index" as well.
Yes, I just decided to put the "HOME" after the forum title. But, I was trying not to have the "HOME" (or anything else) after it. The problem wasn't getting something after the colon, it was trying to use this method and not having anything after the forum title, which I don't think I can do, as the colon will always be there. But, it's a great way of doing this.
Zitat von: Burpee in April 25, 2005, 12:57:46 NACHMITTAGS
The problem now is that the index of your forum is going to have something like "My community - My community - Index" as a title. This is easily fixed through the language files.
Anyone else using SimplePortal? I'm getting
MY COMMUNITY - MY COMMUNITY and I can't seem to fix it. Any suggestions?
Other than that this works great. Thanks a bunch. :)
i made it to prevent on the index to have the forum name twice:
if (substr($context['page_title'],0,strlen($context['forum_name'])) == $context['forum_name'])
echo '<title>', $context['page_title'], '</title>';
else
echo '<title>',$context['forum_name'], ' - ', $context['page_title'], '</title>';
This works excellent. This was one of the few things that I disliked about SMF forums and so glad to have it fixed. Thanks! :D
This is what I use:
if (! ereg($context['forum_name'], $context['page_title']))
$context['page_title'] = $context['forum_name']. ' - ' . $context['page_title'];
I tried using a keyword. This one is good for SEO
First part went fine but my theme doesn't seem to have anything at all called "languages" or anything close...ideas? I'm using the 1.Snake.1 theme. :(
Does anyone know how to remove the extra title in the TinyPortal index page? this is the only thing that I can't figure out...
Is there no control panel function for changing the name of your community after the initial set up? Please forgive my extreme newbie-ness but I couldn't find this info anywhere (even though it's probably in a very obvious place).
Apologies if this is posted in the wrong place.
nice. thanks for this.
Zitat von: Mac_Hines in Juni 02, 2008, 11:58:26 VORMITTAG
Is there no control panel function for changing the name of your community after the initial set up? Please forgive my extreme newbie-ness but I couldn't find this info anywhere (even though it's probably in a very obvious place).
Apologies if this is posted in the wrong place.
Go to Admin -> Server Settings -> Core Configuration. Replace whatever is in "Forum Title" text box.
Zitat von: JohnyB in Juni 05, 2008, 03:38:00 VORMITTAG
Go to Admin -> Server Settings -> Core Configuration. Replace whatever is in "Forum Title" text box.
Thanks JohnyB. It was right where you said it would be!
Quick hack-it-up for people who have long forum names that could be shortened, like mine ("Unseen Britain - Urban Exploration Community")
That was far too big to have on the front of every tab, and looked terrible.
So, I set "Urban Exploration Community" as my forum title in server options, and in index.template changed title to:
<title>Unseen Britain - ', $context['page_title'], '</title>';
On the index it shows the usual "Unseen Britain - Urban Exploration Community", and for all other pages it shows "Unseen Britain - <Page name>". EG: "Unseen Britain - Read first"
Hope some of you can make some use of it :).
You're welcome Mac_Hines. Glad I am of help.
Thank you Tiger Tails for your tip. I am sure it will help other members of our community.
I think if I knew the right word for this I would be able to find my answer elsewhere. This is as close to the subject as I found.
I like how the SMF forum displays a small avatar in the browser page name. Mine has the default browser avatar. I would like to add my own small image followed by my sitename (which this post details)
Are you asking for favicon? We have mods.
http://custom.simplemachines.org/mods/index.php?mod=702
and
http://custom.simplemachines.org/mods/index.php?mod=1329
Likewise, you can follow the guide I made too.
http://www.simplemachines.org/community/index.php?topic=236748.0
Hi
how do I fix this so whenever i go to someone's profile, I will see this
{Custom text I inputed} - Viewing Profile: {Display name}
Zitat von: jepot5 in August 20, 2008, 04:05:59 VORMITTAG
Hi
how do I fix this so whenever i go to someone's profile, I will see this
{Custom text I inputed} - Viewing Profile: {Display name}
Open profile.php
Find:
// Set the page title if it's not already set...
if (!isset($context['page_title']))
$context['page_title'] = $txt['profile'] . ' - ' . $txt[$_REQUEST['sa']];Replace with:
// Set the page title if it's not already set...
if (!isset($context['page_title']))
$context['page_title'] = 'Text you want to show '.$txt['profile'] . ' - ' . $txt[$_REQUEST['sa']];
Zitat von: JohnyB in August 19, 2008, 09:42:20 NACHMITTAGS
Are you asking for favicon? We have mods.
http://custom.simplemachines.org/mods/index.php?mod=702
and
http://custom.simplemachines.org/mods/index.php?mod=1329
Thank you - Yes exactly what I was looking for and the KarlBenson mod worked great.
I wonder if someone would be so kind as to assist me with a problem I am having trying to implement either of the solutions for implementing this change by modifying index_template.php (the babylon theme)
I tried replacing line:
<title>', $context['page_title'], '</title>';
with grandslams mod, and then with Caseys mod and both resulted in a parsing error. I even compared (using notepad++) the resulting source of the file to ensure that that is the only mod to the file. I used the 1.1.5 babylon theme source as the master file.
Where did I go wrong here? Thanks.
Deal
The error I get is:
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in .../Themes/babylon/index.template.php on line 81
line 81 is either of the revised lines selected and pasted from this post.
Zitat von: modtang in September 04, 2005, 08:23:09 NACHMITTAGS
Zitat von: Burpee in April 25, 2005, 12:57:46 NACHMITTAGS
The problem now is that the index of your forum is going to have something like "My community - My community - Index" as a title. This is easily fixed through the language files.
Anyone else using SimplePortal? I'm getting MY COMMUNITY - MY COMMUNITY and I can't seem to fix it. Any suggestions?
Other than that this works great. Thanks a bunch. :)
in Sources/TPortal.php, find:
$context['page_title'] =remove
$context['forum_name']replace with your own
Zitat von: ccbtimewiz in August 20, 2008, 10:21:13 VORMITTAG
Zitat von: jepot5 in August 20, 2008, 04:05:59 VORMITTAG
Hi
how do I fix this so whenever i go to someone's profile, I will see this
{Custom text I inputed} - Viewing Profile: {Display name}
Open profile.php
Find:
// Set the page title if it's not already set...
if (!isset($context['page_title']))
$context['page_title'] = $txt['profile'] . ' - ' . $txt[$_REQUEST['sa']];
Replace with:
// Set the page title if it's not already set...
if (!isset($context['page_title']))
$context['page_title'] = 'Text you want to show '.$txt['profile'] . ' - ' . $txt[$_REQUEST['sa']];
thanks for the help, but not working,
i think the profile pages integrate with tinyportal as when i did the editing for tinyportal (see above post) it also shows the same title when viewing profiles only
and also help me fix
My Community - My Community: Calendar (The first phrase is what I entered and I want to remove "My Community:")
Any way to have the title show:
Board Name - Forum Category - Post Title
for even better SEO
Thanks
I'm using this...
$context['page_title'] = $context['linktree'][0]['name']. ' - ' .
$context['linktree'][1]['name']. ' - ' .
$context['linktree'][2]['name']. ' - ' .
$context['linktree'][3]['name'];
To get...
forum title - category - board name - topic
...as my page title.
The only problem is that when I'm at higher levels of the hierarchy, I get extra dashes. I need to add code to omit the empty elements.
Since I didn't like to put "Home" or "Index" in the first page, my solution was:
In index.template.php put a "short version" of the board name + page title:
<title>Fórum SCP - ', $context['page_title'], '</title>';
In index."language".php put the trimmed part to have the "long version" of the board name, since this is shown just in Home or Index page:
$txt[18] = 'A Comunidade do Sporting Clube de Portugal';
So in sum, except for Index page where we have the full forum title, every other page show "Fórum SCP - Page Title".
Could Someone please tell me if I did something wrong. I don't think I did, but the title now shows up as - - Index, whereas it used to show up as - Index. I obviously missed something, as it didn't change to show the forum name.
Here's what I replaced:
Index.template.php on line 79:
<title>', $context['forum_name'], ' - ', $context['page_title'], '</title>';
index.english.php on line 36:
$txt[18] = 'Index';
Thanks. As you can see, I'm somewhat new to php.
I give up. I've tried this at least a dozen times now and it never works.
Zitat von: Sabby72 in August 30, 2008, 04:37:08 NACHMITTAGS
Could Someone please tell me if I did something wrong. I don't think I did, but the title now shows up as - - Index, whereas it used to show up as - Index. I obviously missed something, as it didn't change to show the forum name.
Here's what I replaced:
Index.template.php on line 79:
<title>', $context['forum_name'], ' - ', $context['page_title'], '</title>';
index.english.php on line 36:
$txt[18] = 'Index';
Thanks. As you can see, I'm somewhat new to php.
It probably means that in Boardindex.php in Sources - I think it's this file that uses $txt[18], you have most likely something weird before $txt[18] that gives - - before the Index word the whole time.
Sabby, undo your other changes, and then add this to index.template.php ....
(just the new code part between the begin/end comments)
function template_main_above()
{
global $context, $settings, $options, $scripturl, $txt, $modSettings;
// -- begin build better page title --
$tboard = $context['linktree'][2]['name'];
$tboard = empty($tboard)?'':' - '.$tboard;
$ttopic = $context['linktree'][3]['name'];
$ttopic = empty($ttopic)?'':' - '.$ttopic;
if (! ereg($context['forum_name'], $context['page_title']))
$context['page_title'] = $context['linktree'][0]['name'].$tboard.$ttopic;
// -- end build better page title --
For some reason, the code in my last post generates errors in the log.
This version of the code doesn't. Am I missing something subtle about the PHP syntax?
$tboard = empty($context['linktree'][2]['name'])?'':' - '.$context['linktree'][2]['name'];
$ttopic = empty($context['linktree'][3]['name'])?'':' - '.$context['linktree'][3]['name'];
if (! ereg($context['forum_name'], $context['page_title']))
$context['page_title'] = $context['linktree'][0]['name'].$tboard.$ttopic;
It would be helpful to know the php error.
hi .. i delete $txt[18] = $context['forum_name'] . ' - Índice';
from my index english and spanish index but does not work
I want the page number of the topic to display in the title. I understand I have to modify Sources/Display.php among others.
These two lines from Display.php are where I think the problems are
censorText($topicinfo['subject']);
$context['page_title'] = $topicinfo['subject'] . " - " . $txt['page'] . $context['page_info']['current_page'];
There is another piece of code in Sources/Messageindex.php which does the smes thing for the boards.
// 'Print' the header and board info.
$context['page_title'] = strip_tags($board_info['name'] . " - " . $txt['page'] . $context['page_info']['current_page']);
Why does the second piece of code display the page number but not the first?
Likely you'll see an error in the error log for an undefined index for $context['page_info']['current_page'] in the first case; it's built differently from what I remember of it.
The whole concept is very bad for SEO the SMF guys knew what they were doing.
to add the same word for verey page on your site, dilutes your unique content, thus making every page on your site less search engine friendly.
Zitat von: Aileen in November 26, 2007, 05:54:56 VORMITTAG
I tried using a keyword. This one is good for SEO
Zitat von: thischarmingmanc in August 17, 2009, 11:38:50 VORMITTAG
The whole concept is very bad for SEO the SMF guys knew what they were doing.
to add the same word for verey page on your site, dilutes your unique content, thus making every page on your site less search engine friendly.
Not if it's the site name or contains a unique keyword that is relevant to the site.
very nice will try it soon..
Ok I think the title is to my satisfaction apart from my quibbles in my last post.
Another solution is to use a Favicon.
nice sharing thanks mate...
Great modification!
However, for me at least when i'm on the index.php it says "My Forum Name - My Forum Name Index" so for the index it repeats "My Forum Name" instead of just showing "My Forum Name - Index"
Any easy ways you see around this?
Thanks!
On the very front page or somewhere else?
And is that for SMF 1.1 or 2.0?
$tboard = empty($context['linktree'][2]['name'])?'':' - '.$context['linktree'][2]['name'];
$ttopic = empty($context['linktree'][3]['name'])?'':' - '.$context['linktree'][3]['name'];
if (! ereg($context['forum_name'], $context['page_title']))
$context['page_title'] = $context['linktree'][0]['name'].$tboard.$ttopic;
This is code works but doesn't print the topic title in child boards. Any idea how I can do it?
Hi guys,
I got a problem with my custom mod (made by a friend of mine)
the link is: смотреть фильмы онлайн (http://kinogrill.kz)
As you see, it uses my forum title, is there a way to fix it, say the title would be "Matches"
Could someone help me out?
Thanks,
Rashid
Just an update to my earlier post. It appears that ereg() is being deprecated in PHP, so I updated the code to use strpos() instead, which happens to be faster anyway.
$tboard = empty($context['linktree'][2]['name'])?'':' - '.$context['linktree'][2]['name'];
$ttopic = empty($context['linktree'][3]['name'])?'':' - '.$context['linktree'][3]['name'];
if (strpos($context['page_title'], $context['forum_name']) === false)
$context['page_title'] = $context['linktree'][0]['name'].$tboard.$ttopic;
Zitat von: grandslam in Februar 18, 2006, 05:27:23 NACHMITTAGS
i made it to prevent on the index to have the forum name twice:
if (substr($context['page_title'],0,strlen($context['forum_name'])) == $context['forum_name'])
echo '<title>', $context['page_title'], '</title>';
else
echo '<title>',$context['forum_name'], ' - ', $context['page_title'], '</title>';
I'm getting this error when I use this code:
Template Parse Error!
It seems something has gone sour on the forum with the template system. This problem should only be temporary, so please come back later and try again. If you continue to see this message, please contact the administrator.
I got version 1.1.11. I've also seen another error that suggested code with ' needed be be closed off with \ or ;. Is there a missing piece of code?
Thanks!
There is nothing wrong with the code above. Where did you put it in your template file?
Same spot as instructed. Weird... I wonder if it has to do with my PHP version?
I'm a newbie and do not know much about these things. I didn't really get these bit confused.... :o :-[
how to add board/child board name in between topic title - and - forum title in 'page title'