1
kain
module-related title hack
  • 2003/4/3 12:15

  • kain

  • Just popping in

  • Posts: 56

  • Since: 2002/1/9 9


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?

2
kain
Re: module-related title
  • 2003/4/4 9:25

  • kain

  • Just popping in

  • Posts: 56

  • Since: 2002/1/9 9


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/viewtopic.php?topic_id=1443&forum=3

3
oddpixel
Re: module-related title
  • 2003/4/4 10:13

  • oddpixel

  • Just popping in

  • Posts: 4

  • Since: 2003/3/26



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.

4
kain
Re: module-related title
  • 2003/4/4 17:23

  • kain

  • Just popping in

  • Posts: 56

  • Since: 2002/1/9 9


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

5
mvandam
Re: module-related title
  • 2003/4/4 21:14

  • mvandam

  • Quite a regular

  • Posts: 253

  • Since: 2003/2/7 2


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.

6
patagon
Re: module-related title hack
  • 2003/4/5 0:31

  • patagon

  • Quite a regular

  • Posts: 235

  • Since: 2002/1/8 0


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...

7
kain
Re: module-related title hack
  • 2003/4/5 1:38

  • kain

  • Just popping in

  • Posts: 56

  • Since: 2002/1/9 9


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

8
drksoul
Re: module-related title hack
  • 2004/4/30 2:01

  • drksoul

  • Just popping in

  • Posts: 18

  • Since: 2004/3/24


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

Login

Who's Online

146 user(s) are online (104 user(s) are browsing Support Forums)


Members: 0


Guests: 146


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits