xoops forums

kain

Just popping in
Posted on: 2003/4/3 12:15
kain
kain (Show more)
Just popping in
Posts: 56
Since: 2002/1/9 9
#1

module-related title hack

it would be a nice feature to add, for example, in the tag <title> the subject of the forum thread displayed.
this feature can dramatically increase visibility in search engines, like geocrawler et similia.
i'm working on this on XOOPS 1.3.9, what do you think?

kain

Just popping in
Posted on: 2003/4/4 9:25
kain
kain (Show more)
Just popping in
Posts: 56
Since: 2002/1/9 9
#2

Re: module-related title

ok, it's done, here's how:

in mainfile.php add

$xoopsConfig['forumpage'] = 0;
$xoopsConfig['forumtitle'] = "";

after $xoopsConfig['db_pconnect'] = 1;

yes, probably isn't the best way but works for me, after this:

-------------
in /modules/newbb/viewtopic.php

take the
include(XOOPS_ROOT_PATH."/header.php"); around line 46 and port it after

$myts->makeTboxData4Show($forumdata['topic_title']);

and before add
$xoopsConfig['forumtitle'] = $forumdata['topic_title'];

so it will result:

- - - - - -
$forumdata['topic_title'] = $myts->makeTboxData4Show($forumdata['topic_title']);
$xoopsConfig['forumtitle'] = $forumdata['topic_title'];
include(XOOPS_ROOT_PATH."/header.php");
- - - - - -

around line 40 of the same file add
$xoopsConfig['forumpage'] = 1;
after
} elseif (empty($topic_id)) {
redirect_header("viewforum.php?forum=$forum",2,_MD_ERRORTOPIC);
exit();
}

so it will result

- - - - - -
} elseif (empty($topic_id)) {
redirect_header("viewforum.php?forum=$forum",2,_MD_ERRORTOPIC);
exit();
}
$xoopsConfig['forumpage'] = 1;
- - - - - -

around line 36-40

------------------------------
in /include/functions.php
find the tag <html> and the others one, replace all with
if ($xoopsConfig['forumpage'] == 1)
{

echo "<html>\n";
echo "<head>\n";
echo "<title>".$xoopsConfig['sitename']." - ".$xoopsConfig['forumtitle']."</title>\n";
echo "<meta http-equiv='Content-Type' content='text/html; charset="._CHARSET."' />\n";
echo "<meta name='author' content='".$xoopsConfig['sitename']."' />\n";
echo "<meta name='copyright' content='Copyright (c) 2002 by ".$xoopsConfig['sitename']."' />\n";
echo "<meta name='keywords' content='".$meta."' />\n";
echo "<meta name='description' content='".$xoopsConfig['slogan']."' />\n";
echo "<meta name='generator' content='".XOOPS_VERSION."' />\n\n";
//$xoopsConfig['forumpage'] = 0;

} else {

echo "<html>\n";
echo "<head>\n";
echo "<title>".$xoopsConfig['sitename']." - ".$xoopsConfig['slogan']."</title>\n";
echo "<meta http-equiv='Content-Type' content='text/html; charset="._CHARSET."' />\n";
echo "<meta name='author' content='".$xoopsConfig['sitename']."' />\n";
echo "<meta name='copyright' content='Copyright (c) 2002 by ".$xoopsConfig['sitename']."' />\n";
echo "<meta name='keywords' content='".$meta."' />\n";
echo "<meta name='description' content='".$xoopsConfig['slogan']."' />\n";
echo "<meta name='generator' content='".XOOPS_VERSION."' />\n\n";


}

so it will result

- - - - - - - -
$meta = $myts->makeTareaData4InsideQuotes($meta);


if ($xoopsConfig['forumpage'] == 1)
{

echo "<html>\n";
echo "<head>\n";
echo "<title>".$xoopsConfig['sitename']." - ".$xoopsConfig['forumtitle']."</title>\n";
echo "<meta http-equiv='Content-Type' content='text/html; charset="._CHARSET."' />\n";
echo "<meta name='author' content='".$xoopsConfig['sitename']."' />\n";
echo "<meta name='copyright' content='Copyright (c) 2002 by ".$xoopsConfig['sitename']."' />\n";
echo "<meta name='keywords' content='".$meta."' />\n";
echo "<meta name='description' content='".$xoopsConfig['slogan']."' />\n";
echo "<meta name='generator' content='".XOOPS_VERSION."' />\n\n";
//$xoopsConfig['forumpage'] = 0;

} else {

echo "<html>\n";
echo "<head>\n";
echo "<title>".$xoopsConfig['sitename']." - ".$xoopsConfig['slogan']."</title>\n";
echo "<meta http-equiv='Content-Type' content='text/html; charset="._CHARSET."' />\n";
echo "<meta name='author' content='".$xoopsConfig['sitename']."' />\n";
echo "<meta name='copyright' content='Copyright (c) 2002 by ".$xoopsConfig['sitename']."' />\n";
echo "<meta name='keywords' content='".$meta."' />\n";
echo "<meta name='description' content='".$xoopsConfig['slogan']."' />\n";
echo "<meta name='generator' content='".XOOPS_VERSION."' />\n\n";


}
include(XOOPS_ROOT_PATH."/include/xoopsjs.php");

- - - - -

around line 52-83

that's all, when you or some search engine spider visits a forum's thread you or he will see the topic title in title's page


example:
http://www.kuht.it/modules/newbb/view ... php?topic_id=1443&forum=3

oddpixel

Just popping in
Posted on: 2003/4/4 10:13
oddpixel
oddpixel (Show more)
Just popping in
Posts: 4
Since: 2003/3/26
#3

Re: module-related title


How about submitting this to be implemented in final XOOPS 2? (I.E mailaing a link to this info to one of the developers)

I gather we all want search engines to properly index messages in our forums etc...

what do you think?

// O.

kain

Just popping in
Posted on: 2003/4/4 17:23
kain
kain (Show more)
Just popping in
Posts: 56
Since: 2002/1/9 9
#4

Re: module-related title

ok, i'll mail a developer, or if they see this topic they can respond directly here.
thanks for your points

mvandam

Quite a regular
Posted on: 2003/4/4 21:14
mvandam
mvandam (Show more)
Quite a regular
Posts: 253
Since: 2003/2/7 2
#5

Re: module-related title

I think this is a good idea in general... i.e. having the title of what you are looking at in the 'title' tag.

However, since there are potentially many modules whose contents may have a 'title', we would want a more general method for doing this, rather than hardcode 'forum'-specific stuff into the core files.

I will submit as a feature request on sourceforge.

patagon

Quite a regular
Posted on: 2003/4/5 0:31
patagon
patagon (Show more)
Quite a regular
Posts: 235
Since: 2002/1/8 0
#6

Re: module-related title hack

Hi:

I think it would be great this made it into XOOPS (I dont know the programming part of this, so how it is no idea :P.

Another benefit is that it makes it easier to bookmark pages..rigth now I think every forum post has the same name if you try to bookmark it...

kain

Just popping in
Posted on: 2003/4/5 1:38
kain
kain (Show more)
Just popping in
Posts: 56
Since: 2002/1/9 9
#7

Re: module-related title hack

i tried to look into postnuke codebase and in fact this hack is present only for news and forums modules, maybe we can use one or more variables that are passed with hidden fields to display their content in <title> (or instead using global variables).
i think that third party modules developers can integrate this or those variables without problem, if they want their modules support this feature; and yes, it makes easier bookmarking pages

drksoul

Just popping in
Posted on: 2004/4/30 2:01
drksoul
drksoul (Show more)
Just popping in
Posts: 18
Since: 2004/3/24
#8

Re: module-related title hack

i'm sort of trying to implement this into XOOPS 2 but it's turning out harder to implement than i hoped.