treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Incuding a .php on every page without include()

  • I want to include a file on every page. I've come across this htaccess trick:
    php_value auto_prepend_file /usr/www/users/website/includes/functions.php

    To my delight, it works perfectly. I would just like to know what the standard practice is. How does wordpress achieve this?
  • Doesn't WordPress uses things like get_footer() to include the footer on every page? Don't know if thats exactly what you're looking for though.
  • I'm not using Wordpress. I asked if anyone knows hoe Wordpress achieves this.
  • It's loaded in the wp-settings.php file.

    // Load the functions for the active theme, for both parent and child theme if applicable.
    if ( TEMPLATEPATH !== STYLESHEETPATH && file_exists( STYLESHEETPATH . '/functions.php' ) )
    include( STYLESHEETPATH . '/functions.php' );
    if ( file_exists( TEMPLATEPATH . '/functions.php' ) )
    include( TEMPLATEPATH . '/functions.php' );