Welcome to Geeklog, Anonymous Friday, April 19 2024 @ 09:36 am EDT

Geeklog Forums

Forum 2.6 - page titles


spintex

Anonymous
Have anyone noticed (and hopefully fixed) the problem with Forum 2.6 where the page titles DO NOT change with the displayed forum thread?

I thought it was just a bad configuration on my site, but I have just found out the geeklog demo site (which uses Forum 2.6) has the same problem. All forum pages have "Geeklog Demo Site - Try out Geeklog here -..." as the page title in the browser.

This site (www.geeklog.net) forums pages however change page titles correctly when a thread is selected. I wonder geeklog.net is running Forum 2.6.

Any help or pointers will be very much appreciated. All my forum pages are being indexed by google with the same description!

Thanks.
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
That's a patch I made. Here's the email I sent to Blaine so that he can roll it into future releases:

I made a minor modification to the forum's viewtopic.php on geeklog.net to get something I always wanted: The subject of the current forum thread in the page's <title>.

Text Formatted Code

// Pass thru filter any get or post variables to only allow numeric values and remove any hostile data
$showtopic = COM_applyFilter($_REQUEST['showtopic'],true);
$show = COM_applyFilter($_REQUEST['show'],true);
$page = COM_applyFilter($_REQUEST['page'],true);
$mode = COM_applyFilter($_REQUEST['mode']);
/*  
$forum = DB_getItem($_TABLES['gf_topic'],"forum","id='$showtopic'");
$topic_pid = DB_getItem($_TABLES['gf_topic'], "pid","id='$showtopic'");
*/
$result = DB_query("SELECT forum, pid, subject FROM {$_TABLES['gf_topic']} WHERE id = '$showtopic'"); // <- new
list($forum, $topic_pid, $subject) = DB_fetchArray($result); // <- new
$highlight = $_REQUEST['highlight'];

(...)

} else {
    echo COM_siteHeader( array('custom_showBlocks',$CONF_FORUM['leftblocks']), $subject ) ; // <-- $subject is new here
    //Check is anonymous users can access
    forum_chkUsercanAccess();
    // Now display the forum header
    ForumHeader($forum,$showtopic);
}
 


Simple and shouldn't create any recognizable additional db load.


Read and compare carefully with the content of viewtopic.php and you should be able to make the modifications.

bye, Dirk
 Quote

spintex

Anonymous
Thanks. Works a treat ! :banana:
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Unfortunately, only half of the above hack made it into Forum 2.7. So here's what you need to change in Forum 2.7 to make it work:

In include/gf_format.php, find the function gf_siteHeader and add $subject everywhere as shown below:
Text Formatted Code
function gf_siteHeader($subject = '') {
    global $CONF_FORUM;

    // Display Common headers
    if (!isset($CONF_FORUM['showblocks'])) $CONF_FORUM['showblocks'] = 'leftblocks';
    if (!isset($CONF_FORUM['usermenu'])) $CONF_FORUM['usermenu'] = 'blockmenu';

    if ($CONF_FORUM['showblocks'] == 'noblocks' OR $CONF_FORUM['showblocks'] == 'rightblocks') {
        echo COM_siteHeader('none', $subject);
    } elseif ($CONF_FORUM['showblocks'] == 'leftblocks' OR $CONF_FORUM['showblocks'] == 'allblocks' ) {
        if ($CONF_FORUM['usermenu'] == 'blockmenu') {
            echo COM_siteHeader( array('custom_showBlocks',$CONF_FORUM['leftblocks']), $subject );
        } else {
            echo COM_siteHeader('menu', $subject);
        }
    } else {
        echo COM_siteHeader('menu', $subject);
    }
}


Then, in viewtopic.php, find the first occurence of "gf_siteHeader" and add "$subject" as the only parameter:
Text Formatted Code
} else {
    // Display Common headers
    gf_siteHeader($subject); // <-- add $subject here
    //Check is anonymous users can access

That should do the trick (as can be seen from the title of this thread).

bye, Dirk
 Quote

ironmax

Anonymous
Quote by: spintex

Have anyone noticed (and hopefully fixed) the problem with Forum 2.6 where the page titles DO NOT change with the displayed forum thread?

I thought it was just a bad configuration on my site, but I have just found out the geeklog demo site (which uses Forum 2.6) has the same problem. All forum pages have "Geeklog Demo Site - Try out Geeklog here -..." as the page title in the browser.

Thanks.



The Geeklog Demo site has now been updated to reflect the changes

Michael
 Quote

All times are EDT. The time is now 09:36 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content