1

in httpd-vhosts.conf I added:

NameVirtualHost *:80

<VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs/tef_ticketing/workspace/htdocs"
    ServerName tef_ticketing.dev
    ServerAlias www.tef_ticketing.dev
    <Directory "C:/xampp/htdocs/tef_ticketing/workspace/htdocs">
        DirectoryIndex home.php
        AllowOverride All
        Require all Granted
    </Directory>
</VirtualHost>

In C:\Windows\System32\drivers\etc\hosts:

127.0.0.1       localhost
127.0.0.1       www.tef_ticketing.dev

in configuration.inc.php

$url = "tef_ticketing.dev";
define("__DOCROOT_URL__", $url);

in home.php

<?php
require_once (dirname(__FILE__) . '/qcubed.inc.php');
\QApplication::Redirect('test_page');

in .htaccess

<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteRule ^$ home.php [L,QSA]
  RewriteRule ^$ ajax.php [L,QSA]
  RewriteRule ^home$ home.php [L,QSA]
  RewriteRule ^test_page$ form.php?form=TestForm [L,QSA]

In TestForm.class.php

<?php
namespace Tef_Ticketing\Presentation\Web\Forms;
use Tef_Ticketing\Presentation\Web\Forms\Form;

class TestForm extends Form {
    protected $btnTest1;
    protected $btnTest2;
    protected $btnTest3;
    protected $lblTest1;

    protected function Form_Create() {
        parent::Form_Create();

        $this->btnTest1 = new \QButton($this);
        $this->btnTest1->Text = 'save1';
        $strJavaScript = "qc.pA('TestForm', 'btnTest2', 'QClickEvent', '', 'QFormWaitIcon');";
        $this->btnTest1->AddAction(new \QClickEvent(), new \QAjaxAction('btnTest1_click'));
        $this->btnTest1->AddAction(new \QClickEvent(), new \QJavaScriptAction($strJavaScript));

        $this->btnTest2 = new \QButton($this, 'btnTest2');
        $this->btnTest2->Text = 'save2';
        $this->btnTest2->AddAction(new \QClickEvent(), new \QAjaxAction('btnTest2_click'));

        $this->btnTest3 = new \QButton($this);
        $this->btnTest3->Text = 'save3';
        $this->btnTest3->AddAction(new \QClickEvent(), new \QAjaxAction('btnTest3_click'));

        $this->lblTest1 = new \QButton($this);
        $this->lblTest1->Text = 'init';
    }

    public function btnTest1_click() {
        sleep(5);
        $this->lblTest1->Text = 'a';
    }

    public function btnTest2_click() {
    }

    public function btnTest3_click() {
        $this->lblTest1->Refresh();
    }

}

When I access in browser the following link www.tef_ticketing.dev I am redirected to http://www.tef_ticketing.dev/test_page , and it is ok. But I have an error:

Fatal error: Class 'Tef_Ticketing\Presentation\Web\Forms\Form' not found in C:\xampp\htdocs\tef_ticketing\workspace\tef_ticketing-presentation\src\Web\Forms\TestForm.class.php on line 5
eu127
  • 123
  • 1
  • 14

2 Answers2

0

It seems that you don't have a Tef_Ticketing\Presentation\Web\Forms\Form.class.php file with a Form class defined. In your file you are relying on the PSR-4 Autoloader standard: http://www.php-fig.org/psr/psr-4/. It requires to have a direct relation between the namespace/class names and filesystem folders structure and file names.

olegabr
  • 443
  • 1
  • 4
  • 13
0

Try

class TestForm extends \Form {

instead of

class TestForm extends Form {

spekary
  • 408
  • 5
  • 10