Comments (4)
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.
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.
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 itHi, 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.
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)
- Cant find where to register my route HOT 1
- -
- Apache Rewrite Failure
- Fatal error: Uncaught Error: Class 'Mini\Core\Application' not found in HOT 2
- Fatal error: Uncaught Error: Class 'Mini\Model\PDO' not found in HOT 4
- German umlauts (ä, ö, ü, and possibly other special characters) removed in parameters of action functions HOT 2
- Import Bootstrap CSS/JS from node modules using NPM HOT 1
- Generating PDFs with PHP mini HOT 3
- can't save the data coming from the database HOT 1
- can't deploy on heroku ! HOT 1
- PDO Debug d'ont work HOT 1
- I've this issue HOT 3
- Bug
- Post request as API is not working
- I Cant Upload Files To Public File
- undefine lastInsertId() HOT 1
- Post a form in Ajax HOT 6
- Fork work with postgresql HOT 3
- How to share function across all views HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mini3.