[ PHPXref.com ] [ Generated: Sun Jul 20 21:14:02 2008 ] [ Zen Cart 1.3.0.1 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/ -> index.php (source)

   1  <?php
   2  /**

   3   * index.php represents the hub of the Zen Cart MVC system

   4   * 

   5   * Overview of flow

   6   * <ul>

   7   * <li>Load application_top.php - see {@tutorial initsystem}</li>

   8   * <li>Set main language directory based on $_SESSION['language']</li>

   9   * <li>Load all *header_php.php files from includes/modules/pages/PAGE_NAME/</li>

  10   * <li>Load html_header.php (this is a common template file)</li>

  11   * <li>Load main_template_vars.php (this is a common template file)</li>

  12   * <li>Load on_load scripts (page based and site wide)</li>

  13   * <li>Load tpl_main_page.php (this is a common template file)</li>

  14   * <li>Load application_bottom.php</li>

  15   * </ul>

  16   *

  17   * @package general

  18   * @copyright Copyright 2003-2005 Zen Cart Development Team

  19   * @copyright Portions Copyright 2003 osCommerce

  20   * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0

  21   * @version $Id: index.php 2942 2006-02-02 04:41:23Z drbyte $

  22   */
  23  /**

  24   * Load common library stuff 

  25   */
  26    require ('includes/application_top.php');
  27  
  28    $language_page_directory = DIR_WS_LANGUAGES . $_SESSION['language'] . '/';
  29    $directory_array = $template->get_template_part($code_page_directory, '/^header_php/');
  30    foreach ($directory_array as $value) { 
  31  /**

  32   * We now load header code for a given page. 

  33   * Page code is stored in includes/modules/pages/PAGE_NAME/directory 

  34   * 'header_php.php' files in that directory are loaded now.

  35   */
  36      require($code_page_directory . '/' . $value);
  37    }
  38  /**

  39   * We now load the html_header.php file. This file contains code that would appear within the HTML <head></head> code 

  40   * it is overridable on a template and page basis. 

  41   * In that a custom template can define its own common/html_header.php file 

  42   */
  43    require($template->get_template_dir('html_header.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/html_header.php');
  44  /**

  45   * Define Template Variables picked up from includes/main_template_vars.php unless a file exists in the

  46   * includes/pages/{page_name}/directory to overide. Allowing different pages to have different overall

  47   * templates.

  48   */
  49    require($template->get_template_dir('main_template_vars.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/main_template_vars.php');
  50  /**

  51   * Read the "on_load" scripts for the individual page, and from the site-wide template settings

  52   * NOTE: on_load_*.js files must contain just the raw code to be inserted in the <body> tag in the on_load="" parameter.

  53   * Looking in "/includes/modules/pages" for files named "on_load_*.js"

  54   */
  55    $directory_array = $template->get_template_part(DIR_WS_MODULES . 'pages/' . $current_page_base, '/^on_load_/', '.js');
  56    foreach ($directory_array as $value) { 
  57      $onload_file = DIR_WS_MODULES . 'pages/' . $current_page_base . '/' . $value;
  58      $read_contents='';
  59      $lines = @file($onload_file);
  60      foreach($lines as $line) {
  61        $read_contents .= $line;
  62      }
  63    $za_onload_array[] = $read_contents;
  64    }
  65  /**

  66   * now read "includes/templates/TEMPLATE/jscript/on_load/on_load_*.js", which would be site-wide settings

  67   */
  68    $directory_array=array();
  69    $tpl_dir=$template->get_template_dir('.js', DIR_WS_TEMPLATE, 'jscript/on_load', 'jscript/on_load_');
  70    $directory_array = $template->get_template_part($tpl_dir ,'/^on_load_/', '.js');
  71    foreach ($directory_array as $value) { 
  72      $onload_file = $tpl_dir . '/' . $value;
  73      $read_contents='';
  74      $lines = @file($onload_file);
  75      foreach($lines as $line) {
  76        $read_contents .= $line;
  77      }
  78      $za_onload_array[] = $read_contents;
  79    }
  80  
  81    // set $zc_first_field for backwards compatibility with previous version usage of this var

  82    if (isset($zc_first_field) && $zc_first_field !='') $za_onload_array[] = $zc_first_field;
  83  
  84    $zv_onload = "";
  85    if (isset($za_onload_array) && count($za_onload_array)>0) $zv_onload=implode(';',$za_onload_array);
  86  
  87    //ensure we have just one ';' between each, and at the end

  88    $zv_onload = str_replace(';;',';',$zv_onload.';');
  89  
  90    // ensure that a blank list is truly blank and thus ignored.

  91    if (trim($zv_onload) == ';') $zv_onload='';
  92  /**

  93   * Define the template that will govern the overall page layout, can be done on a page by page basis

  94   * or using a default template. The default template installed will be a standard 3 column layout. This

  95   * template also loads the page body code based on the variable $body_code.

  96   */
  97    require($template->get_template_dir('tpl_main_page.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/tpl_main_page.php');
  98  ?>
  99  </html>
 100  <?php
 101  /**

 102   * Load general code run before page closes

 103   */
 104  ?>
 105  <?php require (DIR_WS_INCLUDES . 'application_bottom.php'); ?>


[ Powered by PHPXref - Served by Debian GNU/Linux ]