Русское сообщество fluxbb

Быстрый лёгкий надёжный форумный движок

Вы не вошли.

Объявление

Вы можете внести свой вклад в содержание сайта. Жертвователи попадут в почетную группу "Спонсоры". Поддержать сайт.

#1 2006-01-17 13:38:07

[email protected]
Гость

PunBB integration with (almost?) any php-page

My previous message appeared in a strange encoding that I could not recognize. I'll do thi again - in English.

My solution is simple and is based on Apache module mod_rewrite.

1. Put a .htaccess file in your PunBB installation directory.

.htaccess:

RewriteEngine On

RewriteBase /your/path/here/

RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{REQUEST_FILENAME} \.php$
RewriteRule (.*) punbb_wrapper.php [L]

RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{REQUEST_FILENAME} \.php$
RewriteRule ^/?$ punbb_wrapper.php [L]

2. Put a punbb_wrapper.php to the same directory.

punbb_wrapper.php:

<?php

$uri = parse_url($_SERVER['REQUEST_URI']);
if (@$uri['path'] == ($self_dir = dirname($_SERVER['PHP_SELF'])) ||
    @$uri['path'] == $self_dir."/") {
    $inc = dirname(__FILE__)."/index.php";
} elseif (is_file($inc = dirname(__FILE__)."/".basename($uri['path']))) {
    ;
} else {
    die("Illegal usage");
}

// getting HTML generated by PunBB
ob_start();
include_once($inc);
$_ob_contents_punbb = ob_get_contents();
ob_end_clean();
// got HTML generated by PunBB

/**
* Voila!
*
* in the $_ob_contents_punbb variable is the whole HTML output of PunBB page
*
* We could now simply write
*
* echo $_ob_contents_punbb;
* (this is, as you can see, not in any way sensible :-)) )
*
* Or use $_ob_contents_punbb in some other way (for example:
*  $my_smarty->assign('punbb_html', $_ob_contents_punbb);
* )
*
*/

?>

Forgot to mention:
there _is_ one line of PunBB php code that has to be changed if you want to succeed with my approach.
line 161 of footer.php must be changed from

exit($tpl_main);

to

echo($tpl_main);

Have fun ))

-------------- Rubbish before this line ------------------
Sorry everybody. I'm new to PunBB and haven't discovered the <pun_include> template directive before current minute...

Редактировался [email protected] (2006-01-17 15:49:00)

#2 2006-01-24 10:45:01

orbiter
Гость

Re: PunBB integration with (almost?) any php-page

smile а теперь тоже самое но по русски..

#3 2006-01-25 14:14:41

SDTux
Гость

Re: PunBB integration with (almost?) any php-page

Не совсем понял функционал?

Подвал доски

Под управлением FluxBB. Хостинг Hostens