#2939 closed defect (bug) (wontfix)
Variables set in header.php, footer.php, sidebar.php are not inherited by the rest of the page
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | minor | Version: | 2.0.4 |
Component: | Template | Keywords: | has-patch |
Focuses: | Cc: |
Description
I'm not quite sure how to tackle patching this as variables are arbitrary, but when get_header(), get_footer() and get_sidebar() are called, variables won't be passed for use in the main page template.
Call it an annoyance. Not sure how to proceed with passing variables back without returning them in the function or globalizing them. Alternate workarounds are to include() the templates, but this defeats the "purdiness" of the WP functions.
Any thoughts on how to correct?
Attachments (2)
Change History (8)
#4
@
19 years ago
- Cc reuben-dev@… added
It's only called twice per page load, so I expect the impact is minimal. I created a test script for 100 globals and 100 locals called twice (the second call will see 200 globals). On my PowerBook G4 1.5 GHz machine it takes 0.03-0.04 seconds. I'm not sure if this is acceptable or not. Perhaps making it optional? Notice how in the test script (attached as "global-speed.php") I wrap a conditional around the global import/export code.
I suppose globalizing is probably simplest.