A way to actually control page titles

General discussion of development ideas and the approaches taken in the 3.x branch of phpBB. The current feature release of phpBB 3 is 3.3/Proteus.
Forum rules
Please do not post support questions regarding installing, updating, or upgrading phpBB 3.3.x. If you need support for phpBB 3.3.x please visit the 3.3.x Support Forum on phpbb.com.

If you have questions regarding writing extensions please post in Extension Writers Discussion to receive proper guidance from our staff and community.
Post Reply
dcz
Registered User
Posts: 27
Joined: Sat Feb 12, 2005 9:03 pm
Contact:

A way to actually control page titles

Post by dcz »

Hello,

I think that there should be a way to actually control page titles. I know there are several handy event to decide what will be dumped into {PAGE_TITLE} but this is far from actual page title :

Code: Select all

<title><!-- IF UNREAD_NOTIFICATIONS_COUNT -->({UNREAD_NOTIFICATIONS_COUNT}) <!-- ENDIF --><!-- IF not S_VIEWTOPIC and not S_VIEWFORUM -->{SITENAME} - <!-- ENDIF --><!-- IF S_IN_MCP -->{L_MCP} - <!-- ELSEIF S_IN_UCP -->{L_UCP} - <!-- ENDIF -->{PAGE_TITLE}<!-- IF S_VIEWTOPIC or S_VIEWFORUM --> - {SITENAME}<!-- ENDIF --></title> 
I know this is not so trivial to deal with, since page title events are not centralized, but if page title events could either set a flag to fully overwrite or just be detected as having run somewhere, it should be possible to finalize page title in page_header() in a way that would respect custom page titles as well as all these template conditions (it should be doable without too much hax) and then dump it into a single template variable.

I'm not entirely convinced this should be an rfc, but I can post one if it seems more appropriate.

++

User avatar
PayBas
Registered User
Posts: 305
Joined: Tue Jul 29, 2008 6:08 pm
Contact:

Re: A way to actually control page titles

Post by PayBas »

I agree that the current setup isn't ideal, but I'm not sure I understand your particular problem. If your custom page uses {PAGE_TITLE} properly, all the other stuff doesn't really influence the result right? Or you don't want to display notifications count on your custom page or something?

Could you give a specific example of what you currently cannot do?

Keep in mind that if you really want to alter the title for your specific setup, you could just edit the template for your personal needs ;).

dcz
Registered User
Posts: 27
Joined: Sat Feb 12, 2005 9:03 pm
Contact:

Re: A way to actually control page titles

Post by dcz »

Well, you cannot control what gets added to page_title. I mean, you probably can by using a late event (like in page_footer) and overwrite all template variables before you can actually set all of the page title but ...
PayBas wrote:Keep in mind that if you really want to alter the title for your specific setup, you could just edit the template for your personal needs ;).
I have no problem modding phpBB, I'm just trying to use the new code and principle as much as possible (since otherwise adding that much code to phpBB would not mean much).

I'm pretty sure there is a way to allow everybody to adjust page titles as wished and elegantly, but this requires some changes to phpBB base.

While we're at it, and since both could be fixed at the same time, have you read this one : https://area51.phpbb.com/phpBB/viewtopi ... 81&t=45907

Post Reply