Welcome, Guest. Please Login or Register.
November 20, 2017, 06:04:32 PM
Home Help Search Login Register
News: If you are still using YaBB SE, please consider upgrading to SMF as soon as possible.

YaBB SE Community  |  English User Help  |  FAQ  |  Topic: How do I integrate YaBB into my PHP website? « previous next »
Pages: [1] 2 3 4 Reply Ignore Print
Author Topic: How do I integrate YaBB into my PHP website?  (Read 57985 times)
Zef Hemel
Advisor
YaBB God
*****
Posts: 1182


Me too


WWW
How do I integrate YaBB into my PHP website?
« on: December 30, 2001, 05:21:48 AM »
Reply with quote

It is possible, this is how I did it. First modify your template.html and remove all unnecessary stuff. For example like this:
Code: [Select]
<yabb title><br><br>
<yabb uname> <yabb im><BR>
<yabb time><br>
<yabb menu>
<yabb news>

<yabb main>

<yabb copyright>
Then rename your YaBB SE index.php to something else, for example forum.php. And also remove the line in this forum.php that says
Code: [Select]
ob_start();

Then create a new index.php At the first line put:
Code: [Select]
<?php ob_start(); ?>
Underneath that put anything you like, any php tag you like. Basically put your whole design there ;) At the point you want to put the YaBB output, put this:
Code: [Select]
<?php
require("forum.php");

function 
endhtml()
{
?>

then at the end of this php file put this:
Code: [Select]
<?php
}
?>


Then go to Subs.php, to the the obExit() function (around line 760), and after the line with "$HTTP_ACCEPT_ENCODING,$modSettings;" add:
Code: [Select]
endhtml();

Now upload all changed files and it should be working :) Of course you still have to tweak the template.html to make it look better, but you'll get the idea.

Good luck :)
« Last Edit: December 31, 2001, 07:56:44 AM by Zef Hemel » Logged

Blackjack
Noobie
*
Posts: 29


Hubba Hubba, I love brunettes!


WWW
Re:How do I integrate YaBB into my PHP website?
« Reply #1 on: December 30, 2001, 10:48:37 AM »
Reply with quote

Nice FAQ I'm going to try this in my clan site some day :D
Logged


| Payne.nl a Dutch Max Payne site. |
Kalin Somphane
YaBB God
*****
Posts: 555


I am personal text!


WWW
Re:How do I integrate YaBB into my PHP website?
« Reply #2 on: December 30, 2001, 05:52:55 PM »
Reply with quote

I gotta say that's what was bugging me this morning. Thanks
Logged

EZTARCH - The Original YaBBSE PHP Portal
Unlike many others, I accept support requests, in exchange for godly worship every weekday including saturday and sunday.
Kalin Somphane
YaBB God
*****
Posts: 555


I am personal text!


WWW
Re:How do I integrate YaBB into my PHP website?
« Reply #3 on: December 30, 2001, 06:09:20 PM »
Reply with quote

Also.
If you want to put anything below the forum.php it won't work. So you have to put the rest of your website template in your template file.

EDIT: Never mind - didn't read the whole thing.
NOTE: Oh that's why I didn't read the whole thing, because you edited it :)
« Last Edit: January 01, 2002, 02:06:44 PM by tarch » Logged

EZTARCH - The Original YaBBSE PHP Portal
Unlike many others, I accept support requests, in exchange for godly worship every weekday including saturday and sunday.
adams
Jr. Member
**
Posts: 80


http://outersurf.com http://jadz.com


WWW
Re:How do I integrate YaBB into my PHP website?
« Reply #4 on: December 31, 2001, 01:56:53 AM »
Reply with quote

I just encountered this same problem. Any Idea why Zef?

It would appear that as tarch said nothign below the <?php
require("forum.php");
?> is included.
Logged

Zef Hemel
Advisor
YaBB God
*****
Posts: 1182


Me too


WWW
Re:How do I integrate YaBB into my PHP website?
« Reply #5 on: December 31, 2001, 07:58:15 AM »
Reply with quote

Yes you're right, I updated the top message a bit. The changes starts when you put in the require("forum.php"); file.

Good luck, and let me know if there are still problems :)
Logged

TheJkWhoSaysNi
YaBB God
*****
Posts: 1025


I dont know what to put here, i'll leave it blank.


WWW
Re:How do I integrate YaBB into my PHP website?
« Reply #6 on: December 31, 2001, 02:59:22 PM »
Reply with quote

I dont know much php but wouldnt that make it do when you click a link it will just be using template.html? because i tried that before using php virtual
Logged

WARNING: THIS POST MAY CONTAIN TRACES OF PEANUT!!!
I'm listening to....
adams
Jr. Member
**
Posts: 80


http://outersurf.com http://jadz.com


WWW
Re:How do I integrate YaBB into my PHP website?
« Reply #7 on: January 01, 2002, 07:03:57 PM »
Reply with quote

This is my new index.php
Code: [Select]
<?php ob_start(); ?>

<?php
include ('/www/html/template/top.shtml');
?>



<?php
require("forum.php");

function 
endhtml()
{
?>


<?php
include ('/www/html/template/bottem.shtml');
?>


<?php
}
?>


and in Subs.php

Code: [Select]
function obExit()
{
        global $HTTP_ACCEPT_ENCODING,$modSettings;
        if (!$modSettings['enableCompressedOutput'])
        {
                ob_end_flush();
                exit;
        }
        $html = ob_get_contents();
        ob_end_clean();
        $level = 1;

        // Check if zlib is installed
        if(function_exists("crc32") && function_exists("gzcompress"))
        {
        $encoding = '';
                // if so check what kind of gzipping can be used
                if(strpos(" ".$HTTP_ACCEPT_ENCODING, "x-gzip"))
                        $encoding = "x-gzip";
                elseif(strpos(" ".$HTTP_ACCEPT_ENCODING,"gzip"))
                        endhtml();
                        $encoding = "gzip";

                if ($encoding) // ok, encoding is accepted
                {
                        header("Content-Encoding: $encoding");

                        $size = strlen($html);
                        $crc = crc32($html);

                        $output = "\x1f\x8b\x08\x00\x00\x00\x00\x00";
                        $output .= substr(gzcompress($html, $level), 0, -4);
                        $output .= pack("V", $crc);
                        $output .= pack("V", $size);
                }
                else
                $output = $html;
        }
        else
        $output = $html;

        echo $output;
        exit;
}
?>


This still doesn't seem to work (ie my last include is not being processed)

« Last Edit: January 01, 2002, 07:04:57 PM by adams » Logged

alexrolko
Guest
Re:How do I integrate YaBB into my PHP website?
« Reply #8 on: January 01, 2002, 07:10:20 PM »
Reply with quote

Quote
<?php ob_start(); ?>

<?php
include ('/www/html/template/top.shtml');
?>


<?php
require("forum.php");

function endhtml()
{
?>

<?php
include ('/www/html/template/bottem.shtml');
?>

<?php
}
?>


Oh about that code above... after each line you dont have to open and close PHP like the Tutorial says...  ;D

It can just look like this... but thats only if u have just the code.   :-X

Quote
<?php
    ob_start();

    include ('/www/html/template/top.shtml');
    include ('forum.php');

    function endhtml() {
          include ('/www/html/template/bottem.shtml');
    }
?>
« Last Edit: January 01, 2002, 07:16:05 PM by Alex Rolko » Logged
Zef Hemel
Advisor
YaBB God
*****
Posts: 1182


Me too


WWW
Re:How do I integrate YaBB into my PHP website?
« Reply #9 on: January 02, 2002, 05:52:48 AM »
Reply with quote


Code: [Select]
function obExit()
{
       global $HTTP_ACCEPT_ENCODING,$modSettings;
       if (!$modSettings['enableCompressedOutput'])
       {
               ob_end_flush();
               exit;
       }
       $html = ob_get_contents();
       ob_end_clean();
       $level = 1;

       // Check if zlib is installed
       if(function_exists("crc32") && function_exists("gzcompress"))
       {
       $encoding = '';
               // if so check what kind of gzipping can be used
               if(strpos(" ".$HTTP_ACCEPT_ENCODING, "x-gzip"))
                       $encoding = "x-gzip";
               elseif(strpos(" ".$HTTP_ACCEPT_ENCODING,"gzip"))
                       endhtml();
                       $encoding = "gzip";

               if ($encoding) // ok, encoding is accepted
               {
                       header("Content-Encoding: $encoding");

                       $size = strlen($html);
                       $crc = crc32($html);

                       $output = "\x1f\x8b\x08\x00\x00\x00\x00\x00";
                       $output .= substr(gzcompress($html, $level), 0, -4);
                       $output .= pack("V", $crc);
                       $output .= pack("V", $size);
               }
               else
               $output = $html;
       }
       else
       $output = $html;

       echo $output;
       exit;
}
?>


Where's the endhtml()?
Logged

adams
Jr. Member
**
Posts: 80


http://outersurf.com http://jadz.com


WWW
Re:How do I integrate YaBB into my PHP website?
« Reply #10 on: January 02, 2002, 10:02:58 AM »
Reply with quote

Right after the "$HTTP_ACCEPT_ENCODING,"gzip perhaps thats the wrong place?


Indeed it was the wrong place. Now that I fixed it your procedure works like a charm. Thanks Zef.
« Last Edit: January 02, 2002, 10:11:01 AM by adams » Logged

Jaxom
Noobie
*
Posts: 34


Damn llama ate my karma...


WWW
Re:How do I integrate YaBB into my PHP website?
« Reply #11 on: January 04, 2002, 05:49:18 PM »
Reply with quote

Well, I got it working :) Thanks for the info...

Here's a tipette for you non-PHP experts out there...

I spent a good half hour banging my head over this until I finally figured it out (that'll teach me to think I know how to code without reading the references first)

This was what I was trying to get to work:

Code: [Select]
<?php 
    $headervar 
"http://www.theguildhouse.net/meta/header";
    
$extension ".php";
    include (
$headervar.$skin.$extension);
?>



<!--start of content-->

<?php
require("forum.php");

function 
endhtml()
{
$footervar"http://www.theguildhouse.net/meta/footer";
    
$extension ".php";
     include (
$footervar.$skin.$extension);
}
?>


(Note - $skin is set by another included script further up the page, I use it to theme the new website I'm building)


But it didn't work  - The header worked fine, but the footer $skin was never being set. I tried all sorts of things before finding out that basically, you need to add

Code: [Select]
global $skin;
inside the function, like this:


Code: [Select]
<?php 
    $headervar 
"http://www.theguildhouse.net/meta/header";
    
$extension ".php";
    include (
$headervar.$skin.$extension);
?>



<!--start of content-->

<?php
require("forum.php");

function 
endhtml()
{
    global 
$skin;
    
$footervar "http://www.theguildhouse.net/meta/footer";
    
$extension ".php";
include ($footervar.$skin.$extension);
}
?>



I'm used to the idea that a global variable is well, global, and local variables are only accessible inside a function. In PHP, ALL normal variables are global, but you need to declare it as such to access it inside a function. Doh.
« Last Edit: January 04, 2002, 05:53:45 PM by Jaxom » Logged

Linux is like wigwam - no windows, no gates, apache inside.

My wigwam - The Guildhouse
Jaxom
Noobie
*
Posts: 34


Damn llama ate my karma...


WWW
Re:How do I integrate YaBB into my PHP website?
« Reply #12 on: January 04, 2002, 10:08:46 PM »
Reply with quote

Hmm, just discovered (and fixed) a related problem.

Don't forget to do the same thing to Reminder.php!Otherwise people won't be able to get email prompts when they forget their password.

I.E.

Remove

Code: [Select]

ob_start();


From the Reminder.php


rename Reminder.php to something else (I used subreminder.php)

Create a new page called Reminder.php with your custom php code in it, same as the index.php page we created earlier; just replace

Code: [Select]

require("forum.php");


with

Code: [Select]

require("subreminder.php");



HTH!
Logged

Linux is like wigwam - no windows, no gates, apache inside.

My wigwam - The Guildhouse
cessandra
Guest
Re:How do I integrate YaBB into my PHP website?
« Reply #13 on: January 05, 2002, 12:30:12 PM »
Reply with quote

my board: http://unidentity.net/bored

my index.php:
Quote

<?php ob_start();

require("http://unidentity.net/bheader.php");

require("http://unidentity.net/bored/forum.php");

function endhtml()
{

require("http://unidentity.net/footer.php");

}
?>


no matter what link i click on, it just takes me back to index.php.  why?
Logged
cessandra
Noobie
*
Posts: 28



WWW
Re:How do I integrate YaBB into my PHP website?
« Reply #14 on: January 05, 2002, 12:37:29 PM »
Reply with quote

ps

at the end of my board, i get this error:

Quote
Fatal error: Call to undefined function: endhtml() in /export/spare/www/unidentity.net/bored/Sources/Subs.php on line 745


this is my subs.php:
Quote

function obExit()
{
       global $HTTP_ACCEPT_ENCODING,$modSettings;
       endhtml();
       if (!$modSettings['enableCompressedOutput'])
       {
               ob_end_flush();
               exit;
       }
       $html = ob_get_contents();
       ob_end_clean();
       $level = 1;
Logged

cessandra
i would have gotten away with it, too, if it weren't for you meddling kids!
Pages: [1] 2 3 4 Reply Ignore Print 
YaBB SE Community  |  English User Help  |  FAQ  |  Topic: How do I integrate YaBB into my PHP website? « previous next »
 


Powered by MySQL Powered by PHP YaBB SE Community | Powered by YaBB SE
2001-2003, YaBB SE Dev Team. All Rights Reserved.
SMF 2.0.12 | SMF © 2016, Simple Machines
Valid XHTML 1.0! Valid CSS!
Page created in 0.076 seconds with 19 queries.