Master-X
Форум | Новости | Статьи
Главная » Форум » Программинг, Скрипты, Софт, Сервисы » 
Тема: Как работает движок?
цитата
23/08/07 в 08:17
 Sterx
htaccess с модреврайт
индексная страница main.php
rjl tt Код:

<?php

ini_set('display_errors', 'On');
ini_set('error_reporting', E_ALL);
error_reporting(E_ALL);

define("engineRoot", "/home/u4941/domain.com/www/paw/");   

require_once(engineRoot . "loader.php");

$application = new bmApplication(null, null, null);

?>


код loader.php

Код:

<?php
 
                               
  ini_set('memory_limit', '-1');
  ini_set('error_reporting', E_ALL);
  error_reporting(E_ALL);

  function __autoload($class) {
    $filename = $class . ".php";
    if (file_exists(engineRoot . "classes/" . $filename)) {
      require_once(engineRoot . "classes/" . $filename);
    } elseif (file_exists("./userClasses/" . $filename)) {
      require_once("./userClasses/" . $filename);
    }
    if (array_key_exists("application", $GLOBALS)) {
      $locale = $GLOBALS["application"]->dynamicLocale ? array_key_exists('application_locale', $_REQUEST) ? $_REQUEST['application_locale'] : $GLOBALS["application"]->locale : $GLOBALS["application"]->locale;
      if (file_exists(engineRoot . "locales/" . $locale . "/" . $filename)) {
        require_once(engineRoot . "locales/" . $locale . "/" . $filename);
      } elseif (file_exists("./userLocales/" . $locale . "/" . $filename)) {
        require_once("./userLocales/" . $locale . "/" . $filename);
      }
    }
    if (!array_key_exists("loadedClasses", $GLOBALS)) {
      $GLOBALS["loadedClasses"] = array();
      $GLOBALS["loadedClasses"][] = $class;
    } else {           
      $count = count($GLOBALS["loadedClasses"]);
      for ($i = 0; $i < $count; ++$i) {
        $parentClass = $GLOBALS["loadedClasses"][$i];
      }
      if ($i == $count) {
        $GLOBALS["loadedClasses"][] = $class;
      } else {
        array_splice($GLOBALS["loadedClasses"], $i, 0, array($class));
       
      }
    }
  }

?>

как грузится индекс и из чего собирается непонятно.
кроме того мод реврайтом прописаны рулесы:
Код:

RewriteRule ^news/([0-9]+)?$ /main.php?application.switchForm=fNews&application.fNews.newsId=$1 [L]


как и куда ковырять такой движок?
цитата
23/08/07 в 09:19
 xreload
Тебе вообще что нужно ? icon_smile.gif
цитата
23/08/07 в 11:10
 Stek
ха новостью по id твой движок прыгает icon_smile.gif
цитата
23/08/07 в 11:33
 Sterx
мне понять как и чего цепляется.
инклюд лоадера в майне, а дальше - в лоадере функция и все, вызова ее нигде нет
цитата
23/08/07 в 11:57
 Stek
класс bmApplication у тебя запускается, смотри код первого скрипта
цитата
23/08/07 в 11:58
 samedi
Many developers writing object-oriented applications create one PHP source file per-class definition. One of the biggest annoyances is having to write a long list of needed includes at the beginning of each script (one for each class).

In PHP 5, this is no longer necessary. You may define an __autoload function which is automatically called in case you are trying to use a class which hasn't been defined yet. By calling this function the scripting engine is given a last chance to load the class before PHP fails with an error.

http://ru2.php.net/autoload
цитата
23/08/07 в 12:56
 Sterx
samedi: спасиб

еще запись переменной вида application.fNews.newsId
что означает?
цитата
24/08/07 в 07:15
 Formator
В данном случае скорее всего присвоение переменной newsID класса application значения, хранящегося в $1


Эта страница в полной версии