Opened 14 years ago
Closed 9 years ago
#15957 closed enhancement (wontfix)
add two new actions to track template loading
Reported by: | willnorris | Owned by: | koopersmith |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Themes | Keywords: | |
Focuses: | template | Cc: |
Description
I would like to add two new actions "pre_load_template" and "post_load_template" inside the load_template() method. The purpose of this is primarily for debugging and development purposes. For example, I'd like to use these actions to add debug comments in a theme's output along the lines of:
<!-- begin ../themes/twentyten/loop.php --> ... <!-- end ../themes/twentyten/loop.php -->
This makes it much easier to identify which theme file is responsible for which part of the final page, particularly in the case where some files are being pulled from a parent theme and some are from the child theme.
Attachments (1)
Change History (9)
#2
@
14 years ago
- Component changed from Themes to Template
I'm actually using this with Daryl's modular template idea (#12877) so it's definitely related. As for the 'shutdown' action, unless I'm mistaken, that's only called when PHP shuts down. The idea of 'post_load_template' is to be called at the end of each template loading. Since a dozen or more template files can sometimes be involved in constructing a page, this allows you to clearly mark the beginning and end of each template.
#3
@
14 years ago
- Owner set to koopersmith
- Status changed from new to reviewing
Asking for Daryl to weigh in.
#4
@
14 years ago
- Milestone changed from Awaiting Review to Future Release
While the ability to be able to insert content before and after a template is sensible in this context, I'd like to wait before introducing new actions.
I think that at this point, the best way to improve the themes API is to add carefully designed, comprehensive concepts instead of bolting on more functions and filters. I know that this makes certain cases more difficult now, but it will benefit us when it comes to maintaining backwards compatibility later.
In this case, I think that if the concepts are executed properly, these actions won't be necessary.
Related: #13239, #12877
I think a single filter would suffice. You can use the 'shutdown' action instead of 'post_load_template'.