Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm working on a CMS based on Zend Frameowrk and I'm triying to get the mos usefull features from wordpress. One of these is the use of functions.php in the template directory and I think I could do it for my CMS. What about adding a Class in the theme directory (templates/public) and calling (instanciate) it in the bootstrap. What do you think??

share|improve this question

migrated from stackoverflow.com Jul 5 '11 at 13:03

This question came from our site for professional and enthusiast programmers.

    
Why would you not just use view helpers? –  prodigitalson Jun 22 '11 at 23:26
    
So, when you say the most useful features -- are you using the WordPress model or are you going to create a layer over it with Zend? A use-case would be helpful. :) –  Ethan Seifert Aug 4 '11 at 22:33

1 Answer 1

This really has little to do with WP. Processing of that file is simple inclusion, I don't see any complexity to it.

Relevant code from WP core:

// Load the functions for the active theme, for both parent and child theme if applicable.
if ( ! defined( 'WP_INSTALLING' ) || 'wp-activate.php' === $pagenow ) {
    if ( TEMPLATEPATH !== STYLESHEETPATH && file_exists( STYLESHEETPATH . '/functions.php' ) )
        include( STYLESHEETPATH . '/functions.php' );
    if ( file_exists( TEMPLATEPATH . '/functions.php' ) )
        include( TEMPLATEPATH . '/functions.php' );
}
share|improve this answer
    
There is a bit more complexity than you might think. For example, the Zend_Bootstrap usually makes use of Zend_Autoloader which has directory-based class naming conventions for autoloading. This will cause fatal errors trying to parse WP classes unless you explicitly work around it. –  Ethan Seifert Aug 4 '11 at 17:51
    
@Ethan I have no idea how easy or complex it is in Zend, that's why I said it has little to do with WP. :) –  Rarst Aug 4 '11 at 19:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.