Welcome, Guest. Please Login or Register.
April 24, 2024, 03:28:38 PM
Home Help Search Log in Register
News: SMF is the next generation in forum software, almost completely re-written from the ground up, make sure you don't fall for cheap imitations that suffer from feature bloat!

YaBB SE Community  |  English User Help  |  FAQ  |  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 161768 times)
Zef Hemel
Advisor
YaBB God
*****
Posts: 1182


Me too

ICQ - 61109769 WWW
How do I integrate YaBB into my PHP website?
« on: December 30, 2001, 10: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:
<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
ob_start();

Then create a new index.php At the first line put:
<?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:
<?php
require("forum.php");

function 
endhtml()
{
?>

then at the end of this php file put this:
<?php
}
?>


Then go to Subs.php, to the the obExit() function (around line 760), and after the line with "$HTTP_ACCEPT_ENCODING,$modSettings;" add:
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, 12:56:44 PM by Zef Hemel » Logged

Blackjack
Noobie
*
Posts: 29


Hubba Hubba, I love brunettes!

ICQ - 52160615 WWW
Re:How do I integrate YaBB into my PHP website?
« Reply #1 on: December 30, 2001, 03:48:37 PM »
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!

ICQ - 20280987 WWW
Re:How do I integrate YaBB into my PHP website?
« Reply #2 on: December 30, 2001, 10: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!

ICQ - 20280987 WWW
Re:How do I integrate YaBB into my PHP website?
« Reply #3 on: December 30, 2001, 11: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, 07: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, 06: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

ICQ - 61109769 WWW
Re:How do I integrate YaBB into my PHP website?
« Reply #5 on: December 31, 2001, 12:58:15 PM »
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.

ICQ - 122821095TheJkWhoSaysNi@evilemail.com WWW
Re:How do I integrate YaBB into my PHP website?
« Reply #6 on: December 31, 2001, 07: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 02, 2002, 12:03:57 AM »
Reply with quote

This is my new index.php
<?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

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 02, 2002, 12:04:57 AM by adams » Logged

alexrolko
Guest
Re:How do I integrate YaBB into my PHP website?
« Reply #8 on: January 02, 2002, 12:10:20 AM »
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 02, 2002, 12:16:05 AM by Alex Rolko » Logged
Zef Hemel
Advisor
YaBB God
*****
Posts: 1182


Me too

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

Quote from: adams on January 02, 2002, 12:03:57 AMfunction 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, 03:02:58 PM »
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, 03:11:01 PM 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, 10: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:

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

global $skin;
inside the function, like this:


<?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, 10: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 05, 2002, 03:08:46 AM »
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

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

require("forum.php");

with

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, 05: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


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

ps

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

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

this is my subs.php:
Quotefunction 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  |  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.1.4 © 2023, Simple Machines
Valid XHTML 1.0! Valid CSS

Page created in 0.084 seconds with 20 queries.