System Variables

$data_flow: This is an Array type variable that allows you to send parameters from one component to another.

To illustrate its use we will show an example of use. Suppose we have created a process with two components, one a Code type we call "Request" and the second component type HTML will call "Page" component. The following figure shows the components arranged in the workspace:


For the first component (Request) add the following code:


 $section = '';  
 $this->CI->executemodel->html_output = FALSE;  
 if(isset($_GET['section'])){  
      $section = $_GET['section'];  
 }  
 switch($section){  
      case 'home':  
           $data_flow['body_content'] = '<h1>This is home page</h1>';  
      break;  
      case 'services':  
           $data_flow['body_content'] = '<h1>This is services page</h1>';  
      break;  
      default:  
           $data_flow['body_content'] = '<h1>404 - Page not found</h1>';  
      break;  
 }  

In the code above what is done is to assess the user's request, according to the request, use the variable "$data_flow" to store a value (body_content) to be sent to the next component (Page).

For the next component insert the following code:


 <!DOCTYPE html>  
 <html lang="en">  
 <head>  
      <title>Test</title>  
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">  
 </head>  
 <body>  
      {body_content}  
 </body>  
 </html>  

Note that the "Page" component is of type html so you can not insert the php code in this sense we use the wildcard {body_content} (Down the use of wildcards is described). You can try this example to familiarize you with the $data_flow variable.
Wildcard: A wildcard is an expression to insert php variables in components not directly execute php code. There are three types of wildcards
  • {wildcard_name}: This wildcard is used to insert values ​​of $data_flow variable as we saw in the previous example.
  • {POST::wildcard_name}: insert this wildcard values ​​from the $_POST variable, which is usually used in the form submission.
  • {GET::wildcard_name}: insert this wildcard values ​​from the $_GET variable, which is used mainly in the web links.
$this->CI->executemodel->html_output: This variable can be used to stop the habitual behavior that the system, which involves the process output in HTML. In the first example on the $data_flow variable, the "Request" component change the default variable TRUE to FALSE to prevent the output html had two blocks.

$this->CI->executemodel->listComps2Execute: This variable is of type Array and contains a list of all components to be executed in the current process ordered by their location in the execution tree, you can use this variable to change the order of execution of the components, as well as prevent any of them from running.

Note: Improper use of the variable $this->CI- executemodel->listComps2Execute may cause unexpected errors in the execution of the process. Be sure to use the utmost caution possible.

$this->CI->executemodel->allcomponents: This variable is of type Array and contains a list of all components to be executed in the current process in no particular order, some of the components in this list may not be executed in the process because they are not linked to any other component which is not part of execution tree. You can use this variable only for consultation, since its modification should not alter the process execution.

Note: While modifying the variable $this->CI->executemodel->allcomponents should not alter the execution of the process, if it could cause a conflict with the Carrying out of some components. So be sure to use the utmost caution possible.

$this->CI->executemodel->rootComponent: This entry contains the root component of the process.

$this->CI->executemodel->actProject: This entry contains the ID of the project that contains the running process.

$this->CI->executemodel->cssSheets: This variable is of type Array and contains the url of the style sheets to be added to the header of the default output of the process. You can customize this variable.

$this->CI->executemodel->jsLibs: This variable is of type Array and contains the url of the javascripts that were added to the header of the default output of the process. You can customize this variable.

$this->CI->executemodel->jsScripts: This variable is of type Array and contains javascripts that were added to the header of the default output of the process. Note that the system involves the values ​​of this variable between the tags: "<script type="text/javascript"> ... </ script>". You can customize this variable.

$root_folder: Contains the directory path on the implementation of the process. If you modify this variable may conflict other components.

No hay comentarios:

Publicar un comentario