1
jayjay
Hack: dokuwiki with xoops_pagetitle
  • 2007/5/23 12:49

  • jayjay

  • Not too shy to talk

  • Posts: 175

  • Since: 2003/9/10


Howdie!

I was looking for a way to implement XOOPS pagetitles in the Dokuwiki module, but I couldn't find anything on this site or on Xoopsforge. Then I figured: why not implement it myself

Put this in doku.php:

if($_SERVER['REQUEST_URI'] == '/modules/dokuwiki/doku.php?'){
  
$xoopsTpl->assign('xoops_pagetitle''Start | '.$xoopsModule->name()); }
  else {
  
$title ereg_replace('/modules/dokuwiki/doku.php/(.*)''1'$_SERVER['REQUEST_URI']);
  
$title ucfirst(ereg_replace('_'' '$title));
  
$xoopsTpl->assign('xoops_pagetitle'$title.' | '.$xoopsModule->name()); }


just before this line at the end of the file:
include_once XOOPS_ROOT_PATH."/footer.php";


I basically used $_SERVER['REQUEST_URI'] to extract part of the URL and then used regular expressions to strip the first part off.

I use the internal url rewrite option in dokuwiki ('$conf['userewrite'] = 2;' in /conf/dokuwiki.php), but I guess someone can figure out a way to make this work without mod_rewrite (I'm too lazy )

Cheers,

Jay Jay

2
jayjay
Hack: phpwiki with xoops_pagetitle
  • 2007/5/24 7:44

  • jayjay

  • Not too shy to talk

  • Posts: 175

  • Since: 2003/9/10


The same is possible for the older phpwiki module.

Add this to index.php just above "include("../../footer.php")":

if($_SERVER['REQUEST_URI'] == '/modules/phpwiki/index.php'){
$xoopsTpl->assign('xoops_pagetitle'$xoopsModule->name()); }
else {
$title preg_replace('(/modules/phpwiki/index.php?pagename=(.*))''$1'$_SERVER['REQUEST_URI']);
$title ucfirst(ereg_replace('%20'' '$title));
$xoopsTpl->assign('xoops_pagetitle'$title.' | '.$xoopsModule->name()); }


This time I used preg_replace because ereg_replace wouldn't stick.

3
jayjay
Re: Hack: dokuwiki with xoops_pagetitle
  • 2007/8/7 5:11

  • jayjay

  • Not too shy to talk

  • Posts: 175

  • Since: 2003/9/10


I optimized the script for the upcoming dokuwiki for XOOPS 2.1 release:

if ($conf['userewrite'] == '0') {
  
$REQUEST_URI $_SERVER['REQUEST_URI'];
  if(
preg_match('/?id=/i'$REQUEST_URI)) {
  
$title preg_replace('((.*?)?id=(.*))''$2'$_SERVER['REQUEST_URI']);
  
$title ucfirst(ereg_replace('_'' '$title));
  
$title ereg_replace(':'' - '$title);
  
$xoopsTpl->assign('xoops_pagetitle'$title.' | '.$xoopsModule->name());
  } else {
   
$xoopsTpl->assign('xoops_pagetitle'$xoopsModule->name());
  }
 }
 elseif (
$conf['userewrite'] == '2') {
  
$REQUEST_URI $_SERVER['REQUEST_URI'];
  if(
preg_match('//doku.php//i'$REQUEST_URI)) {
  
$title preg_replace('((.*?)/doku.php/(.*))''$2'$_SERVER['REQUEST_URI']);
  
$title ucfirst(ereg_replace('_'' '$title));
  
$title ereg_replace(':'' - '$title);
  
$xoopsTpl->assign('xoops_pagetitle'$title.' | '.$xoopsModule->name());
  } else {
   
$xoopsTpl->assign('xoops_pagetitle'$xoopsModule->name());
  }
 }
 else {
  
$xoopsTpl->assign('xoops_pagetitle'$xoopsModule->name());
 }

4
Peekay
Re: Hack: dokuwiki with xoops_pagetitle
  • 2007/8/7 10:29

  • Peekay

  • XOOPS is my life!

  • Posts: 2335

  • Since: 2004/11/20


Thx jayjay!. The above (optimised) script worked a treat.
A thread is for life. Not just for Christmas.

Login

Who's Online

424 user(s) are online (331 user(s) are browsing Support Forums)


Members: 0


Guests: 424


more...

Donat-O-Meter

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

Latest GitHub Commits