[wp-trac] Re: [WordPress Trac] #6686: New Feature: insert header & footer snippets

WordPress Trac wp-trac at lists.automattic.com
Sat Apr 12 16:56:03 GMT 2008


#6686: New Feature: insert header & footer snippets
----------------------------+-----------------------------------------------
 Reporter:  Mrasnika        |        Owner:  anonymous
     Type:  enhancement     |       Status:  new      
 Priority:  normal          |    Milestone:  2.7      
Component:  Template        |      Version:           
 Severity:  normal          |   Resolution:           
 Keywords:  header, footer  |  
----------------------------+-----------------------------------------------
Comment (by darkdragon):

 That is an interesting design. I've also used it plenty of times, however,
 you are still creating an instance of a class when an instance is not
 needed.

 Instead of:
 {{{
 new hefo();
 }}}

 How about:
 {{{
 hefo::init();
 }}}

 In this way, since the method call is static, the reference to the object
 does not need to be made.

 However, in the init() method, you will have to initialize the object,
 since you don't use static method calls either. I would suggest using
 static method calls:

 Instead of:

 {{{
 array(&$this, 'methodname')
 }}}

 try this instead:

 {{{
 array('classname', 'methodname')
 }}}

 You take a considerable hit using the first one, but the second is almost
 as fast as the function call.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/6686#comment:8>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list