Embedding part of phpBB3 onto WebPage

Discussion forum for MOD Writers regarding MOD Development.
TeknoAXE
Registered User
Posts: 28
Joined: Sun Sep 08, 2013 2:36 am

Embedding part of phpBB3 onto WebPage

Post by TeknoAXE »

Okay, so, first of all, hello! I've been using PHPBB3 for a few months as a social feature on my website. Today was a really exciting day where I delved deep into the CSS functions and template HTML files to modify the look and function of the forum to mimick my main website. You can compare them too.

Main Website:
http://teknoaxe.com/cgi-bin/home.pl

Forum:
http://www.teknoaxe.com/phpBB3/index.php

There are some minor differences between the two pages as you can see, but the user can definitely get the impression that they haven't left my site when going to the forums.

So what more could I want, you ask? Well, I want to try to increase the continuity between the forums and integrate more of PHPBB3 onto the regular site to promote a more dynamic experience when viewing my main content. I want to start off basic by adding just the PHPBB3 User control Panel, FAQ, Search, Members Login bar just underneath the main dropdown menu. I tried embedding a modded php file into site using iframes. This sort of worked, but produced an entire webpage with page header, footer, and background image, which I don't really need.

I also tried embedding php code, but I suspect I need to make an .htaccess file for the CGI folder that all my main code is located at, because the php code isn't putting anything on the page at the moment.

I suppose I really shot myself in the foot when choosing perl to construct my main site, but I was wondering if any of you had any suggestions on how to embed just pieces of the forum into website.

Thanks!

Matt
Pony99CA
Registered User
Posts: 4783
Joined: Thu Sep 30, 2004 3:13 pm
Location: Hollister, CA
Name: Steve

Re: Embedding part of phpBB3 onto WebPage

Post by Pony99CA »

Have you tried making your Web site pages custom phpBB pages? Read the Add a New Custom Page to phpBB Knowledge Base article.

Steve
Silicon Valley Pocket PC (http://www.svpocketpc.com)
Creator of manage_bots and spoof_user (ask me)
Need hosting for a small forum with full cPanel & MySQL access? Contact me or PM me.
TeknoAXE
Registered User
Posts: 28
Joined: Sun Sep 08, 2013 2:36 am

Re: Embedding part of phpBB3 onto WebPage

Post by TeknoAXE »

I guess the only problem with that is I would need to mess with the php code pretty significantly. Up to this point, my website has been procedurally generated with perl. Porting that code over to perl shouldn't be a problem, but then I would need to know where to put the bits and pieces into the phpBB3 API.
User avatar
Lumpy Burgertushie
Registered User
Posts: 69228
Joined: Mon May 02, 2005 3:11 am

Re: Embedding part of phpBB3 onto WebPage

Post by Lumpy Burgertushie »

the easiest thing would be to change your main site over to either php or html files or both instead of perl.

I haven't heard of anyone creating a website in perl in many years if ever.

trying to convert any of phpbb to perl would really be shooting yourself in the foot, let, butt, maybe even head.

:lol:

luck,
robert
Premium phpBB 3.3 Styles by PlanetStyles.net

I am pleased to announce that I have completed the first item on my bucket list. I have the bucket.
User avatar
AmigoJack
Registered User
Posts: 6127
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン

Re: Embedding part of phpBB3 onto WebPage

Post by AmigoJack »

Perl is very versatile, but sadly WORN (write once, read never = you're unable to read the code). There are several ways to start with:
  1. execute the Perl script in PHP (provided the server allows so), see Stack Overflow: Calling Perl script from PHP and passing in variables, while also using variablized perl script name.
  2. Execute the PHP script in Perl:

    Code: Select all

    my $response= qx(usr/local/bin/php ../custom.php);
  3. Try to interpret PHP code using a Perl module, see metacpan: PHP::Interpreter. However, won't work with PHP 5.3.
  4. Try to interpret Perl code using the Perl PECL module, see PECL: perl. Code examples: Stack Overflow: How can I use Perl libraries from PHP? and PerlMonks: Using Perl Code from PHP.
  5. An article from 2007 which looks at both ways: Linux Journal Archive: Integrating PHP and Perl.
  • "The problem is probably not my English but you do not want to understand correctly. ... We will not come anybody anyway, nevertheless, it's best to shit this." Affin, 2018-11-20
  • "But this shit is not here for you. You can follow with your. Maybe the question, instead, was for you, who know, so you shoved us how you are." axe70, 2020-10-10
  • "My reaction is not to everyone, especially to you." Raptiye, 2021-02-28
TeknoAXE
Registered User
Posts: 28
Joined: Sun Sep 08, 2013 2:36 am

Re: Embedding part of phpBB3 onto WebPage

Post by TeknoAXE »

[quote="AmigoJack"]Perl is very versatile, but sadly WORN (write once, read never = you're unable to read the code).

When you say WORN, do you mean that you don't get to read the code when viewing the page source? Because I'm doing a basic port of my site in PHP right now, and it's going to be essentially the same, in that respect. No one will read the code that puts the site together, just the HTML and the Javascript that results from it.
Pony99CA
Registered User
Posts: 4783
Joined: Thu Sep 30, 2004 3:13 pm
Location: Hollister, CA
Name: Steve

Re: Embedding part of phpBB3 onto WebPage

Post by Pony99CA »

TeknoAXE wrote:
AmigoJack wrote:Perl is very versatile, but sadly WORN (write once, read never = you're unable to read the code).
When you say WORN, do you mean that you don't get to read the code when viewing the page source?
(Fixed managled quote)

No, he means that Perl is indecipherable after you've written it, making it difficult to maintain. But let's not waste time debating the truth of that statement. ;)

Steve
Silicon Valley Pocket PC (http://www.svpocketpc.com)
Creator of manage_bots and spoof_user (ask me)
Need hosting for a small forum with full cPanel & MySQL access? Contact me or PM me.
TeknoAXE
Registered User
Posts: 28
Joined: Sun Sep 08, 2013 2:36 am

Re: Embedding part of phpBB3 onto WebPage

Post by TeknoAXE »

Well, I did it...

I ported my entire site over to PHP. :P I'm gonna go to bed now.
TeknoAXE
Registered User
Posts: 28
Joined: Sun Sep 08, 2013 2:36 am

Re: Embedding part of phpBB3 onto WebPage

Post by TeknoAXE »

Okay...

My website is completely ported over to PHP now, and I've been able to incorporate some PHPBB3 elements in a few areas, such as sections that show user posts on my main site.

You can see some of that here: http://www.teknoaxe.com/Home.php
Where I've added a simple news feed,

and here: http://teknoaxe.com/Techno_Code.php
Where I've added a scan of posts that people have made to advertise their videos in my forums.

So...

Here's what I want.
Image

Any thoughts?

Thanks, so far, for the advice you guys have given me. It has helped a bit.
User avatar
AmigoJack
Registered User
Posts: 6127
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン

Re: Embedding part of phpBB3 onto WebPage

Post by AmigoJack »

Yes: look it up.
  1. In the page source you'll notice accesskey="e" is within what you want, so search all files for that text and you'll find /styles/*/template/overall_header.html.
  2. There, you'll see the same code but with variables (or more precisely: placeholders), i.e. {PRIVATE_MESSAGE_INFO} and {U_SEARCH_SELF}. Search all files case sensitive for PRIVATE_MESSAGE_INFO and you'll find /includes/functions.php.
  3. There it is an array element key which is assigned with $l_privmsgs_text, so search for that one in the same file topwards. That will lead you to lines 4485 ff.
  4. That's basically how to find code. The $user object is instantiated by including /common.php and then calling $user-> session_begin() - just like Add a New Custom Page to phpBB tells you.
If you want exactly the same navigation bar behaviour as in phpBB you have to either copy larger parts of code from above (which gives you the chance to skip unneeded code) or to just call page_header() yourself (which will also work in the future once you update your board).
  • "The problem is probably not my English but you do not want to understand correctly. ... We will not come anybody anyway, nevertheless, it's best to shit this." Affin, 2018-11-20
  • "But this shit is not here for you. You can follow with your. Maybe the question, instead, was for you, who know, so you shoved us how you are." axe70, 2020-10-10
  • "My reaction is not to everyone, especially to you." Raptiye, 2021-02-28
TeknoAXE
Registered User
Posts: 28
Joined: Sun Sep 08, 2013 2:36 am

Re: Embedding part of phpBB3 onto WebPage

Post by TeknoAXE »

Okay, so thank you, amigo, for your advice. I've looked up the example that you cited, but I haven't gotten it to work just yet. I feel I'm very close to it, but I'm missing maybe one or two things.

ex: http://teknoaxe.com/Home_3.php

So this is my experimental page that's out of site and out of mind for most of the people who view my site. At the top, you will notice a table displaying some of the place-holder values that you would see looking through the template files. That's not the actual code, that's just what I want it to look like. The actual code is:

Code: Select all

<?php
$template->set_filenames(array(
    'body' => 'MenuBar.html',
));
make_jumpbox(append_sid("{$phpbb_root_path}Home_3.$phpEx"));
include "MenuBar.html";
?>
A few things to know:
1) This piece of code does not include the part where the board gets user information. That's already done before the webpage even begins, and it makes things like the news-feed and the "user videos" sections on this site work. I know this for a fact because I accidentally tried to display form posts that guests didn't have permissions to view and got mysql errors that made my site look like crap. Correcting the form permissions fixed this.

2) Also, the page header is not called because, obviously, the page header has already been defined at this point.

3) Other than the include "MenuBar.html" as a placeholder, nothing is happening with this code. This is good because it's not interfering with the rest of the webpage. It's bad, obviously because the information I'm wanting to display isn't there.

Question: So I'm looking at the code, and I'm guessing that I'm using the make_jumpbox(append_sid function wrong. Can anyone school me on what the correct way use this function is? Am I at least using the $tempate defining function right?

Thanks,

Matt
User avatar
Lumpy Burgertushie
Registered User
Posts: 69228
Joined: Mon May 02, 2005 3:11 am

Re: Embedding part of phpBB3 onto WebPage

Post by Lumpy Burgertushie »

if you are going to use the phpbb variables then you have to call phpbb at the very top of your php page:

Code: Select all

    <?php
    define('IN_PHPBB', true);
    $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
    $phpEx = substr(strrchr(__FILE__, '.'), 1);
    include($phpbb_root_path . 'common.' . $phpEx);

    // Start session management
    $user->session_begin();
    $auth->acl($user->data);
    $user->setup();

    page_header('Title Here');

    $template->set_filenames(array(
        'body' => 'yourpage_body.html',
    ));

    make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx"));
    page_footer();
    ?>
Premium phpBB 3.3 Styles by PlanetStyles.net

I am pleased to announce that I have completed the first item on my bucket list. I have the bucket.
TeknoAXE
Registered User
Posts: 28
Joined: Sun Sep 08, 2013 2:36 am

Re: Embedding part of phpBB3 onto WebPage

Post by TeknoAXE »

Lumpy Burgertushie wrote:if you are going to use the phpbb variables then you have to call phpbb at the very top of your php page:

Code: Select all

    <?php
    define('IN_PHPBB', true);
    $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
    $phpEx = substr(strrchr(__FILE__, '.'), 1);
    include($phpbb_root_path . 'common.' . $phpEx);

    // Start session management
    $user->session_begin();
    $auth->acl($user->data);
    $user->setup();

    page_header('Title Here');

    $template->set_filenames(array(
        'body' => 'yourpage_body.html',
    ));

    make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx"));
    page_footer();
    ?>
As I've said so before in the post you responded to, I've already done that, which is why the "news" and "user videos" sections of my website work. I've already figured that out. The part I'm trying to figure out is if I need to modify that append_sid commant to generate the html in the specific spot on my webpage that I want.
TeknoAXE
Registered User
Posts: 28
Joined: Sun Sep 08, 2013 2:36 am

Re: Embedding part of phpBB3 onto WebPage

Post by TeknoAXE »

Orrr....I guess the easier thing would be to extract user information like messages, time visited and control panel link and then just build the phpbb3 nav bar myself...maybe.
User avatar
Lumpy Burgertushie
Registered User
Posts: 69228
Joined: Mon May 02, 2005 3:11 am

Re: Embedding part of phpBB3 onto WebPage

Post by Lumpy Burgertushie »

the jumpbox part looks ok , however, this part is not:
include "MenuBar.html";

also, are you saying that the code I posted above is at the very top of this Home3.php file?

it would help if we could see the whole file.



robert
Premium phpBB 3.3 Styles by PlanetStyles.net

I am pleased to announce that I have completed the first item on my bucket list. I have the bucket.

Return to “[3.0.x] MOD Writers Discussion”