gmb_include_view

Include a view.

Description

gmb_include_view( (string) $file, (constant) $full = false, (array) $data = array() ); 

NOTE: First this attempts to load from GMB_PLUGIN_PATH . /includes/ then it trys GMP_CORE_PATH .'/includes', unless $full NOTE: Uses include() not include_once()

Parameters (3)

0. $file (string)
File path relative to either core includes path or plugin includes path. Use full absolute path if $full param is true
1. $full — Optional. (constant) => false
If true, $file param should be a full absolute path. Default is false.
2. $data — Optional. (array) => array()
An array of values to be used in the view via output buffering. Default is an empty array which skips output buffering.

Usage

  1. if ( !function_exists( 'gmb_include_view' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'maps-builder/vendor/wordimpress/maps-builder-core/includes/misc-functions.php'; 
  3.  
  4. // File path relative to either core includes path or plugin includes path. Use full absolute path if $full param is true 
  5. $file = ''; 
  6.  
  7. // Optional. If true, $file param should be a full absolute path. Default is false. 
  8. $full = false; 
  9.  
  10. // Optional. An array of values to be used in the view via output buffering. Default is an empty array which skips output buffering. 
  11. $data = array(); 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = gmb_include_view($file, $full, $data); 
  15.  

Defined (1)

The function is defined in the following location(s).

/vendor/wordimpress/maps-builder-core/includes/misc-functions.php  
  1. function gmb_include_view( $file, $full = false, $data = array() ) { 
  2. $file = gmb_find_view( $file, $full ); 
  3.  
  4. /** 
  5. * Filter file path for gmb_include_view 
  6. * @since 2.1 
  7. * @param string $file File path -- should be a full absolute path 
  8. * @param bool $full If this function is using full file path mode or not 
  9. */ 
  10. $file = apply_filters( 'gmb_gmb_include_view_file', $file, $full ); 
  11.  
  12. if ( file_exists( $file ) ) { 
  13. if ( ! empty( $data ) ) { 
  14. extract( $data, EXTR_SKIP ); 
  15. ob_start(); 
  16. include( $file ); 
  17. if ( ! empty( $data ) ) { 
  18. echo ob_get_clean(); 
  19.  
  20. return true; 
  21. } else { 
  22. return false;