Giter Site home page Giter Site logo

Comments (4)

devnaelson avatar devnaelson commented on May 22, 2024

Fast Optionaly solution while not have one another at moment

Folder Controller/Authserver/TestController.PHP

<?php
namespace Mini\Controller\Authserver;

class TestController
{
    public function index()
    {
       echo "Hello";
    }
}

config.php
define('NEW_FOLDER', array('Authserver'));

` } elseif (!empty($this->url_controller)) {

        $amountFolders = count(NEW_FOLDER); // addicional folders

        $checkFileStep0 = file_exists(APP . 'Controller/' . ucfirst($this->url_controller) . 'Controller.php');

        if ($checkFileStep0 === false) {

            for ($i = 0; $i < count(NEW_FOLDER); $i++) {

                $checkFileStep1 = file_exists(APP . 'Controller/' . ucfirst(NEW_FOLDER[$i]) . '/' . ucfirst($this->url_controller) . 'Controller.php');

                if ($checkFileStep1 === true) {

                    //path
                    $controller = "\\Mini\\Controller\\" . ucfirst(NEW_FOLDER[$i]) . "\\" . ucfirst($this->url_controller) . 'Controller';

                    $this->url_controller = new $controller();

                    if (method_exists($this->url_controller, $this->url_action) && is_callable(array($this->url_controller, $this->url_action))) {

                        if (!empty($this->url_params)) {

                            call_user_func_array(array($this->url_controller, $this->url_action), $this->url_params);
                        } else {

                            $this->url_controller->{$this->url_action}();
                        }

                    } else {
                        if (strlen($this->url_action) == 0) {

                            $this->url_controller->index();
                        } else {
                            $page = new \Mini\Controller\ErrorController();
                            $page->index();
                        }
                    }
                }
            }

        } else {

            // here we did check for controller: does such a controller exist ?

            // if so, then load this file and create this controller
            // like \Mini\Controller\CarController
            $controller = "\\Mini\\Controller\\" . ucfirst($this->url_controller) . 'Controller';

            $this->url_controller = new $controller();

            // check for method: does such a method exist in the controller ?
            if (method_exists($this->url_controller, $this->url_action) && is_callable(array($this->url_controller, $this->url_action))) {

                if (!empty($this->url_params)) {
                    // Call the method and pass arguments to it
                    call_user_func_array(array($this->url_controller, $this->url_action), $this->url_params);
                } else {
                    // If no parameters are given, just call the method without parameters, like $this->home->method();
                    $this->url_controller->{$this->url_action}();
                }

            } else {
                if (strlen($this->url_action) == 0) {
                    // no action defined: call the default index() method of a selected controller
                    $this->url_controller->index();
                } else {
                    $page = new \Mini\Controller\ErrorController();
                    $page->index();
                }
            }
        }

    } else {

        $page = new \Mini\Controller\ErrorController();
        $page->index();
    }`

from mini3.

panique avatar panique commented on May 22, 2024

I not got call a new folder into of controller folder and use.
I will tries put it when me have time or whether you could make it

Hi, sorry but I dont understand the problem!

from mini3.

devnaelson avatar devnaelson commented on May 22, 2024

I not got call a new folder into of controller folder and use.
I will tries put it when me have time or whether you could make it

Hi, sorry but I dont understand the problem!

Not's problem!
I was trying create new folders into of controller folder, but not work and then i did this and create my own method simple for add it.

from mini3.

wfsdaj avatar wfsdaj commented on May 22, 2024

Fast Optionaly solution while not have one another at moment

Folder Controller/Authserver/TestController.PHP

<?php
namespace Mini\Controller\Authserver;

class TestController
{
    public function index()
    {
       echo "Hello";
    }
}

config.php define('NEW_FOLDER', array('Authserver'));

` } elseif (!empty($this->url_controller)) {

        $amountFolders = count(NEW_FOLDER); // addicional folders

        $checkFileStep0 = file_exists(APP . 'Controller/' . ucfirst($this->url_controller) . 'Controller.php');

        if ($checkFileStep0 === false) {

            for ($i = 0; $i < count(NEW_FOLDER); $i++) {

                $checkFileStep1 = file_exists(APP . 'Controller/' . ucfirst(NEW_FOLDER[$i]) . '/' . ucfirst($this->url_controller) . 'Controller.php');

                if ($checkFileStep1 === true) {

                    //path
                    $controller = "\\Mini\\Controller\\" . ucfirst(NEW_FOLDER[$i]) . "\\" . ucfirst($this->url_controller) . 'Controller';

                    $this->url_controller = new $controller();

                    if (method_exists($this->url_controller, $this->url_action) && is_callable(array($this->url_controller, $this->url_action))) {

                        if (!empty($this->url_params)) {

                            call_user_func_array(array($this->url_controller, $this->url_action), $this->url_params);
                        } else {

                            $this->url_controller->{$this->url_action}();
                        }

                    } else {
                        if (strlen($this->url_action) == 0) {

                            $this->url_controller->index();
                        } else {
                            $page = new \Mini\Controller\ErrorController();
                            $page->index();
                        }
                    }
                }
            }

        } else {

            // here we did check for controller: does such a controller exist ?

            // if so, then load this file and create this controller
            // like \Mini\Controller\CarController
            $controller = "\\Mini\\Controller\\" . ucfirst($this->url_controller) . 'Controller';

            $this->url_controller = new $controller();

            // check for method: does such a method exist in the controller ?
            if (method_exists($this->url_controller, $this->url_action) && is_callable(array($this->url_controller, $this->url_action))) {

                if (!empty($this->url_params)) {
                    // Call the method and pass arguments to it
                    call_user_func_array(array($this->url_controller, $this->url_action), $this->url_params);
                } else {
                    // If no parameters are given, just call the method without parameters, like $this->home->method();
                    $this->url_controller->{$this->url_action}();
                }

            } else {
                if (strlen($this->url_action) == 0) {
                    // no action defined: call the default index() method of a selected controller
                    $this->url_controller->index();
                } else {
                    $page = new \Mini\Controller\ErrorController();
                    $page->index();
                }
            }
        }

    } else {

        $page = new \Mini\Controller\ErrorController();
        $page->index();
    }`

Hello, do you have the complete code? I referred to your code and did not implement the corresponding function. Thank you.

from mini3.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.