WordPress.org

Make WordPress Core

Opened 15 years ago

Closed 15 years ago

Last modified 14 years ago

#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: technosailor 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)

patch-2939a.diff (940 bytes) - added by nelsonrp 15 years ago.
patch for wp-includes/theme.php to import/export global name-space
global-speed.php (1.7 KB) - added by nelsonrp 15 years ago.
Speed test script.

Download all attachments as: .zip

Change History (8)

#1 @ryan
15 years ago

  • Milestone changed from 2.0.4 to 2.1

I suppose globalizing is probably simplest.

@nelsonrp
15 years ago

patch for wp-includes/theme.php to import/export global name-space

#2 @nelsonrp
15 years ago

  • Keywords has-patch added

#3 @markjaquith
15 years ago

Are there any performance issues with this?

@nelsonrp
15 years ago

Speed test script.

#4 @nelsonrp
15 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.

#5 @matt
15 years ago

  • Resolution set to wontfix
  • Status changed from new to closed

It's better for individual vars to set them, rather than us doing it automatically.

#6 @Nazgul
14 years ago

  • Milestone 2.1 deleted
Note: See TracTickets for help on using tickets.