Welcome to (long awaited) Hook System!

Discuss features as they are added to the new version. Give us your feedback. Don't post bug reports, feature requests, support questions or suggestions here.
Forum rules
Discuss features as they are added to the new version. Give us your feedback. Don't post bug reports, feature requests, support questions or suggestions here. Feature requests are closed.
Rhodes
Registered User
Posts: 5
Joined: Fri Jul 04, 2008 10:03 am

Re: Welcome to (long awaited) Hook System!

Post by Rhodes » Fri Jul 04, 2008 3:56 pm

So, Okay... sorry but this does noting.

I made a test site with php what just displays some html but no phpBB3 appears there.
The docs/hook_system.html leaves just :?: :?: :?: :? at me.

I made a hook_testinclude.php; into includes/hook and tried the examples from the docs there, just to get something. But I do not even get where the heck the hook wants my custom functions now... the doc says its included by common.php after I purged my cache (what I didnt find in the admin system so I tried all the refresh buttons there) but it doesnt seem to be included at all.

What now?

User avatar
Acyd Burn
Posts: 1838
Joined: Tue Oct 08, 2002 5:18 pm
Location: Behind You
Contact:

Re: Welcome to (long awaited) Hook System!

Post by Acyd Burn » Fri Jul 04, 2008 4:12 pm

Rhodes wrote:So, Okay... sorry but this does noting.

I made a test site with php what just displays some html but no phpBB3 appears there.
Then the path is wrong or something halted the execution... it is working fine. Have a look at the joomla bridge (rokbridge) for example, they use the hooks system too.
The docs/hook_system.html leaves just :?: :?: :?: :? at me.

I made a hook_testinclude.php; into includes/hook and tried the examples from the docs there, just to get something. But I do not even get where the heck the hook wants my custom functions now...
Sorry, but if this is too hard for you i suggest you seek for help at the main forums, the mod authors forum best... it is all explained within the document, you need to tell phpBB the name of your hook function, from the docs:
Now we register the hooks one by one with the $phpbb_hook->register() method:

Code: Select all

// Now, we register our append_sid "replacements" in a stacked way...
// Registering the function (this is called first)
$phpbb_hook->register('append_sid', 'my_append_sid');

[...]
So, append_sid is the function to hook (ours) and my_append_sid is the function which is called (yours) - both having the same parameter.

... i will try if i can come up with a step by step paragraph for hooks - but really, they are usually meant for application developers who want to bridge phpBB. If you just want to authenticate through phpBB or your application you do not need to use hooks. If you want to mod something, you are not able to use hooks.

Image

Rhodes
Registered User
Posts: 5
Joined: Fri Jul 04, 2008 10:03 am

Re: Welcome to (long awaited) Hook System!

Post by Rhodes » Fri Jul 04, 2008 4:34 pm

Well what I want is briefly the following: I have a site and a forum. I now want to include my forum into that side so that it looks like if the forum was displayed there in an iframe, but without using iframes. Therefore I wanted to hook into $template->display($handle, $include_once = true); so that my site header, footer and sidemenu is displayed as if it was done by $themplate->display(). Dealing with changes to templates and so on I want to care for later, for now it would be nice if I only get an "hello" displayed above the forum header. With that I could at least imagine how to get the html for the divs from my site to bring it into phpBB's templatesystem.

Authentication I want too, but I saw that there is an auth api what I planned to dig into later after I solved the displaying of the forum into my site.
So if one assumes my site is an application then yes I want to include phpBB into my application.

I will try to look at joomla maybe it gives me more hints.
... i will try if i can come up with a step by step paragraph for hooks
That would really really help I think as the doc html seems a bit too abstract.

User avatar
Acyd Burn
Posts: 1838
Joined: Tue Oct 08, 2002 5:18 pm
Location: Behind You
Contact:

Re: Welcome to (long awaited) Hook System!

Post by Acyd Burn » Fri Jul 04, 2008 5:15 pm

Rhodes wrote:Well what I want is briefly the following: I have a site and a forum. I now want to include my forum into that side so that it looks like if the forum was displayed there in an iframe, but without using iframes. Therefore I wanted to hook into $template->display($handle, $include_once = true); so that my site header, footer and sidemenu is displayed as if it was done by $themplate->display().
For this, you could adjust the overall_header and footer within the phpBB template...
Dealing with changes to templates and so on I want to care for later, for now it would be nice if I only get an "hello" displayed above the forum header. With that I could at least imagine how to get the html for the divs from my site to bring it into phpBB's templatesystem.
The hook(s) is/are meant for executing external code from within the hooked function, not "using" the functions per se. Hooking the template->display() method is usually needed if you need to "bend" assigned variables or add/change assigned loops (for example someone could add a new "hand-made" forum using hooks). If you just want to "use" the template engine you need to use the template engine within your site. ;)

Anyway... to hook template->display you would only need to embed phpBB into your site (with the code i posted above), register your hook (as explained within the doc) and then do the code magic from within your function which get called once template->display() is executed. But your approach is completely wrong for what you want to achive.
Authentication I want too, but I saw that there is an auth api what I planned to dig into later after I solved the displaying of the forum into my site.
No, the auth api is different (naming conflict for this doc, may be confusing). You need to have a look at includes/auth/*
So if one assumes my site is an application then yes I want to include phpBB into my application.
Never assume something. ;) But if you want to see your site as an application, with it's own template engine, it's own authentication, permissions, session handling, etc. - then yes, it may be an application. But still, the goal need to fit too.

First of all, i would try to solve your "blank page" problem. With the code above (putting it into test.php within your sites folder and having phpBB within the phpbb folder one beneath [Adjust the path if needed] and executing yoursite/test.php should display the board index as if you called phpbb directly). This also leads to one essential problem in application integration. You usually always have to entry points - the board and the application. Therefore, it is suggested to put some files on "do not access mode". ;) Some did this by making the apparent phpBB files inaccessible and routing pages through one of their site pages, for example:

Code: Select all

mysitecode/
board/
board_installation_hidden/
within board you would have the "router", within the site your site and within board_installation_hidden the sole boards code (without the need to ever really touch it).

As you can see by the above, it is not as easy as it sounds. ;) And therefore not a shame if this is not crystal clear to you.

Image

User avatar
Acyd Burn
Posts: 1838
Joined: Tue Oct 08, 2002 5:18 pm
Location: Behind You
Contact:

Re: Welcome to (long awaited) Hook System!

Post by Acyd Burn » Fri Jul 04, 2008 5:16 pm

Oh, and code documentation will of course always be abstract and never be a step-by-step tutorial (else it would be a step-by-step tutorial ;)). The intended audience is not the beginner, but the pro.

Image

Rhodes
Registered User
Posts: 5
Joined: Fri Jul 04, 2008 10:03 am

Re: Welcome to (long awaited) Hook System!

Post by Rhodes » Tue Jul 08, 2008 3:20 pm

Thanks for your detailed reply.
For this, you could adjust the overall_header and footer within the phpBB template...
That's too easy for my apporach since I need to deal with the sessions on my side also, what means, I need to get the current session of the user somehow. Actually the display() method was only my attempt since it seemed easier to implement to understand the system.
In the final however, I need to use the login system of phpBB (since phpBB will be used to hold the user's profile), the template system and finally deal with phpBB's session IDs. I am still at the beginning of going through it so I don't know yet how what will be used eventually.
The hook(s) is/are meant for executing external code from within the hooked function, not "using" the functions per se.
That was the idea actually, to browse to the phpBB forum and have phpBB to get some html and other informations from my site's scripts.
If you just want to "use" the template engine you need to use the template engine within your site.
This seems even more difficult to me, since I know from using functions of phpBB to convert another (handmade) forum into phpBB, where I ran into problems since phpBB is not php5-style strict-objectoriented (using global variables and functions and so on).
No, the auth api is different (naming conflict for this doc, may be confusing). You need to have a look at includes/auth/*
I will... I think... 8-)
Oh, and code documentation will of course always be abstract and never be a step-by-step tutorial (else it would be a step-by-step tutorial ;)). The intended audience is not the beginner, but the pro.
Well I would see myself as an average, not pro. But it was enough at least to convert an C#/MSSQL-implemented forum to phpBB3 including passwords (wich were plaintext fortunately), pms, profiles and topics. That forced me already to dig a bit through phpBB for instance to get to know how to use the passwordencryption or to parse the bbcode into something the phpBB secondpass would understand.

Well now I have all users of my site in phpBB and I am sort of forced to get phpBB to handle all these things like profiles and so on (need to get UCP into my site as well).

No, the apporach is not easy but I am trying anyhow :D


bluehipy
Registered User
Posts: 1
Joined: Sun Jun 07, 2009 3:13 pm

Re: Welcome to (long awaited) Hook System!

Post by bluehipy » Sun Jun 14, 2009 12:23 am

Maybe this will help somebody looking for how to set the template display hook:

http://www.joy2share.com/code/log/phpBB-hooks.html

Rhodes wrote:So, Okay... sorry but this does noting.

I made a test site with php what just displays some html but no phpBB3 appears there.
The docs/hook_system.html leaves just :?: :?: :?: :? at me.

I made a hook_testinclude.php; into includes/hook and tried the examples from the docs there, just to get something. But I do not even get where the heck the hook wants my custom functions now... the doc says its included by common.php after I purged my cache (what I didnt find in the admin system so I tried all the refresh buttons there) but it doesnt seem to be included at all.

What now?

Post Reply