TinyPortal

Development => Support => Topic started by: OIDanTheManIO on December 09, 2005, 03:39:30 PM

Title: Index title?
Post by: OIDanTheManIO on December 09, 2005, 03:39:30 PM
Where is the title on the frontpage of TP declared?  The title being <title></title>.  I can't seem to find it anywhere.
Title: Re: Index title?
Post by: gerrymo on December 09, 2005, 03:40:33 PM
Its in index.template.php
Title: Re: Index title?
Post by: OIDanTheManIO on December 09, 2005, 03:46:38 PM
Quote from: gerrymo on December 09, 2005, 03:40:33 PM
Its in index.template.php

No sir, I meant for the TP FRONTPAGE.
Title: Re: Index title?
Post by: gerrymo on December 09, 2005, 03:56:35 PM
Sorry. Can you expand on this? I dont see what title you mean.
Title: Re: Index title?
Post by: IchBin on December 09, 2005, 03:58:33 PM
I'm no expert, but I do believe it is from the index.template.php
But the actual title is called from the $context['page_title']. I think that means depending on which template file is being called in the index.template (boardindex, or messageindex etc.) the page title is different.
I've been meaning to ask Bloc if he would explain a little bit how this works:
global $context, $settings, $options, $txt;  Where are these globals located. :)

--edit after a bit of searching I found the page title being set in the TPortal.php file in the Sources directory at this line:
        // Set the page title.
        $context['page_title'] = $context['forum_name'];
Title: Re: Index title?
Post by: bloc on December 10, 2005, 07:59:55 PM
Quite right. :)


The globals..? They are from any file that have been loaded at that time. So if you load in Load.php(which always is executed) it sets up $settings. But to use that, you need to make it avaiable via the "global" call, so that YOUR function can access it too. ( I think php just copy over the variable to each function and updates back and forth, but not sure) Therefore its effecient to just load in the ones you will need.

Missing globals will many times explain why something just don't work..even if all seems perfectly fine. ;)
Title: Re: Index title?
Post by: OIDanTheManIO on December 10, 2005, 08:06:07 PM
Quote from: IchBinâââ,¬Å¾Ã,¢ on December 09, 2005, 03:58:33 PM
I'm no expert, but I do believe it is from the index.template.php
But the actual title is called from the $context['page_title']. I think that means depending on which template file is being called in the index.template (boardindex, or messageindex etc.) the page title is different.
I've been meaning to ask Bloc if he would explain a little bit how this works:
global $context, $settings, $options, $txt;  Where are these globals located. :)

--edit after a bit of searching I found the page title being set in the TPortal.php file in the Sources directory at this line:
        // Set the page title.
        $context['page_title'] = $context['forum_name'];


I already knew that.  What I need to know is in what file is $context['page_title'] called?
Title: Re: Index title?
Post by: bloc on December 10, 2005, 08:23:01 PM
index.template is the one actually setting the title tag - which use the data in the $context variable. And each Source file sets that variable according to what it does.
Title: Re: Index title?
Post by: OIDanTheManIO on December 10, 2005, 08:43:05 PM
Quote from: Bloc on December 10, 2005, 08:23:01 PM
index.template is the one actually setting the title tag - which use the data in the $context variable. And each Source file sets that variable according to what it does.

Thanks, I found what I needed.
Title: Re: Index title?
Post by: jazz on January 22, 2006, 07:04:00 AM
I wish it was described what the solution was.  On the front page of TinyPortal, the page title is just "Home".  How do I change that to the site name?
Title: Re: Index title?
Post by: elpvn on January 22, 2006, 08:28:45 AM
You can find this code in Index.tempate.php"

// The main sub template above the content.
function template_main_above()
{
global $context, $settings, $options, $scripturl, $txt, $modSettings;


after that, you will see code:

// Show right to left and the character set for ease of translating.
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml"', $context['right_to_left'] ? ' dir="rtl"' : '', '><head>
<meta http-equiv="Content-Type" content="text/html; charset=', $context['character_set'], '" />
<meta name="description" content="', $context['page_title'], '" />
<meta name="keywords" content="PHP, MySQL, bulletin, board, free, open, source, smf, simple, machines, forum" />
<script language="JavaScript" type="text/javascript" src="', $settings['default_theme_url'], '/script.js?rc2"></script>
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
var smf_theme_url = "', $settings['theme_url'], '";
var smf_images_url = "', $settings['images_url'], '";
var smf_scripturl = "', $scripturl, '";
// ]]></script>
<title>', $context['page_title'], '</title>';


Replace it with this code:

// Show right to left and the character set for ease of translating.
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml"', $context['right_to_left'] ? ' dir="rtl"' : '', '><head>
<meta http-equiv="Content-Type" content="text/html; charset=', $context['character_set'], '" />

<meta name="description" content="YOUR CONTENTS">
<meta NAME="keywords" CONTENT="THE KEY WORD OF YOUR CONTENT HERE"> <meta NAME="ROBOTS" CONTENT="ALL">

<script language="JavaScript" type="text/javascript" src="', $settings['default_theme_url'], '/script.js?rc2"></script>
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
var smf_theme_url = "', $settings['theme_url'], '";
var smf_images_url = "', $settings['images_url'], '";
var smf_scripturl = "', $scripturl, '";
// ]]></script>

<title>YOUR TITLE, YOUR TEXT HERE</title>


:)
Title: Re: Index title?
Post by: jazz on January 22, 2006, 08:46:24 AM
Thanks!  That's exactly what I was looking for.
Title: Re: Index title?
Post by: Nokonium on January 22, 2006, 01:49:06 PM
There is also this way  8)

TPortal.english
find:
$txt['tp-home'] = 'Home';

replace with
$txt['tp-home'] = $context['forum_name'];