[RFC|Implemented] page_header hook

These requests for events in core phpBB have been merged into 3.1/Ascraeus and will be available with the next release.
Post Reply
User avatar
nickvergessen
Former Team Member
Posts: 733
Joined: Sun Oct 07, 2007 11:54 am
Location: Stuttgart, Germany
Contact:

[RFC|Implemented] page_header hook

Post by nickvergessen »

Name: hook_page_header
Rationale: The hook could be used to reduce edits for all mods, that need to load a language file globally or define a link in the overall_header.html
Placement: includes/functions.php
Input arguments: $page_title, $display_online_list, $item_id, $item
Output format: void
Output semantics: nothing
Related: A template-hook which you can use to add new links right next to the FAQ-Link: viewtopic.php?p=212631#p212631
Member of the Development-TeamNo Support via PM

User avatar
imkingdavid
Registered User
Posts: 1050
Joined: Thu Jul 30, 2009 12:06 pm

Re: [RFC] page_header hook

Post by imkingdavid »

I agree with this, especially that last bit about adding to the FAQ, Members, etc link area.
I do custom MODs. PM for a quote!
View My: MODs | Portfolio
Please do NOT contact for support via PM or email.
Remember, the enemy's gate is down.

gn#36
Registered User
Posts: 8
Joined: Mon Aug 30, 2010 9:09 pm

Re: [RFC] page_header hook

Post by gn#36 »

Yes, a lot of mods need to add a link to that menu.

Jhong
Registered User
Posts: 50
Joined: Tue Dec 26, 2006 3:28 pm

Re: [RFC] page_header hook

Post by Jhong »

This is great.

However, I think for loading scripts and CSS files a more elegant solution is needed. At the minimum, two hooks, for "before other scripts" and "after other scripts", but even better would be a load_phpbb_script() function where you could specify priority and dependencies (see WordPress' enqueue_script() for an example).

There are other hooks I would need in the header too -- the order is important. These are the hooks I would currently need:

hook_dtd (override the DTD)
hook_meta (override the meta or add new values)
hook_scripts_before
hook_scripts_after

in addition to the hook to add a link with the FAQ, etc. links.

User avatar
Erik Frèrejean
Registered User
Posts: 207
Joined: Thu Oct 25, 2007 2:25 pm
Location: surfnet
Contact:

Re: [RFC] page_header hook

Post by Erik Frèrejean »

This hook should also be capable to be used as an replacement of page_header, for example if you're trying to build an third party application around phpBB and need system calls like login_box() these functions call the page header. If in that case the actual page header is called, there might arise various issues with the third party application. There are ways to hack your way around this currently but it would be much nicer if you can simply override the phpBB page header with your own code.

Proposed change:
nickvergessen wrote:Output format: void|bool
Output semantics: If the return format of the hook is "void" or "false", continue execution of the page header (as with the initial RFC). However if the return value is "true", do not execute the phpBB page header.

Code: Select all

function page_header(....)
{
   if ($phpbb_hook->result())
   {
      return;
   } 
Available on .com
Support Toolkit developer

Jamika
Registered User
Posts: 1
Joined: Thu Jan 19, 2012 3:29 pm

Re: [RFC] page_header hook

Post by Jamika »

great suggestion!

User avatar
Steve©
Registered User
Posts: 1
Joined: Sun Feb 12, 2012 11:11 am

Re: [RFC] page_header hook

Post by Steve© »

:) , i was going to post this suggestion ,I've already created this for my mods :oops:

Looking forward to 3.1 ;)

Oleg
Posts: 1150
Joined: Tue Feb 23, 2010 2:38 am
Contact:

Re: [RFC] page_header hook

Post by Oleg »

I have this ledge in ledges-2: https://github.com/p/phpbb3/compare/dev ... 2Fledges-2 for my trivial css extension.
nickvergessen wrote: Input arguments: $page_title, $display_online_list, $item_id, $item
Template ledges do not have arguments, if they are needed this needs to be discussed somewhere.
Jhong wrote:This is great.

However, I think for loading scripts and CSS files a more elegant solution is needed. At the minimum, two hooks, for "before other scripts" and "after other scripts", but even better would be a load_phpbb_script() function where you could specify priority and dependencies (see WordPress' enqueue_script() for an example).
What you described for script loading is a good idea but it's off topic here.
Jhong wrote:There are other hooks I would need in the header too -- the order is important. These are the hooks I would currently need:

hook_dtd (override the DTD)
What would you need this for? DTD is defined by the style.
Jhong wrote:hook_meta (override the meta or add new values)
Overriding meta would be a different ledge, adding meta you can do with the generic header ledge.
Jhong wrote:hook_scripts_before
hook_scripts_after
Before and after what?
Jhong wrote:in addition to the hook to add a link with the FAQ, etc. links.
Probably a different topic for these as well.
Erik Frèrejean wrote:This hook should also be capable to be used as an replacement of page_header, for example if you're trying to build an third party application around phpBB and need system calls like login_box() these functions call the page header. If in that case the actual page header is called, there might arise various issues with the third party application. There are ways to hack your way around this currently but it would be much nicer if you can simply override the phpBB page header with your own code.
This would be a different ledge.

User avatar
nickvergessen
Former Team Member
Posts: 733
Joined: Sun Oct 07, 2007 11:54 am
Location: Stuttgart, Germany
Contact:

Re: [RFC] page_header hook

Post by nickvergessen »

Oleg wrote:
nickvergessen wrote: Input arguments: $page_title, $display_online_list, $item_id, $item
Template ledges do not have arguments, if they are needed this needs to be discussed somewhere.
This topic is not about template hooks ;)
nickvergessen wrote:...
Placement: includes/functions.php
...
Related: A template-hook which you can use to add new links right next to the FAQ-Link: viewtopic.php?p=212631#p212631
:geek:
Member of the Development-TeamNo Support via PM

User avatar
MichaelC
Development Team
Development Team
Posts: 889
Joined: Thu Jan 28, 2010 6:29 pm

Re: [RFC] page_header hook

Post by MichaelC »

https://github.com/p/phpbb3/commit/3498 ... 5d4ab7bad8 implements this and includes an override.
Formerly known as Unknown Bliss
psoTFX wrote: I went with Olympus because as I said to the teams ... "It's been one hell of a hill to climb"
No unsolicited PMs please except for quotes.

Post Reply