phpBB

Development Discussion Board

phpBB's testing ground of bleeding edge code
Advanced search

[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.

[RFC|Implemented] page_header hook

Postby nickvergessen » Sat Aug 21, 2010 1:35 pm

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
cheers nickvergessen :geek:
Member of phpBB Development-Team
No Support via PM — My MODs for phpBB 3.0.x
User avatar
nickvergessen
Development Team
Development Team
 
Posts: 350
Joined: Sun Oct 07, 2007 11:54 am
Location: Esslingen, Germany

Re: [RFC] page_header hook

Postby imkingdavid » Sat Aug 21, 2010 8:36 pm

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.
User avatar
imkingdavid
Development Team
Development Team
 
Posts: 900
Joined: Thu Jul 30, 2009 12:06 pm

Re: [RFC] page_header hook

Postby gn#36 » Tue Aug 31, 2010 9:12 pm

Yes, a lot of mods need to add a link to that menu.
gn#36
Registered User
 
Posts: 8
Joined: Mon Aug 30, 2010 9:09 pm

Re: [RFC] page_header hook

Postby Jhong » Wed Sep 01, 2010 1:53 am

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.
Jhong
Registered User
 
Posts: 50
Joined: Tue Dec 26, 2006 3:28 pm

Re: [RFC] page_header hook

Postby Erik Frèrejean » Wed Mar 30, 2011 12:21 pm

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
User avatar
Erik Frèrejean
Registered User
 
Posts: 207
Joined: Thu Oct 25, 2007 2:25 pm
Location: surfnet

Re: [RFC] page_header hook

Postby Jamika » Thu Jan 19, 2012 3:35 pm

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

Re: [RFC] page_header hook

Postby Steve© » Thu Feb 16, 2012 5:55 pm

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

Looking forward to 3.1 ;)
User avatar
Steve©
Registered User
 
Posts: 1
Joined: Sun Feb 12, 2012 11:11 am

Re: [RFC] page_header hook

Postby Oleg » Fri Feb 17, 2012 9:52 am

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.
Oleg
3.1 Release Manager
3.1 Release Manager
 
Posts: 1150
Joined: Tue Feb 23, 2010 2:38 am

Re: [RFC] page_header hook

Postby nickvergessen » Sat Feb 18, 2012 11:59 am

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:
cheers nickvergessen :geek:
Member of phpBB Development-Team
No Support via PM — My MODs for phpBB 3.0.x
User avatar
nickvergessen
Development Team
Development Team
 
Posts: 350
Joined: Sun Oct 07, 2007 11:54 am
Location: Esslingen, Germany

Re: [RFC] page_header hook

Postby MichaelC » Thu May 31, 2012 3:12 pm

https://github.com/p/phpbb3/commit/3498 ... 5d4ab7bad8 implements this and includes an override.
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.
User avatar
MichaelC
Website Team
Website Team
 
Posts: 797
Joined: Thu Jan 28, 2010 6:29 pm


Return to [3.1/Ascraeus] Merged Event Requests

Who is online

Users browsing this forum: No registered users and 2 guests