front-controller

.htaccess front controller mod rewrite trouble

廉价感情. 提交于 2019-12-11 15:06:43
问题 I know this should be simple but I'm having a hard time writing the .htaccess rule for my front controller. The /themes/ folder contains all my css/js/images etc so I don't want them to pass though my controller The .htaccess file is in the root of the /myadminarea/ folder. The root of the site (below '/myadminarea' on '/' has NO .htacess file) Inside the front controller I look at the URL and then include the file directly - however I want to be quite forgiving with the Urls I accept.. If

What are these routing styles called in a web application?

本秂侑毒 提交于 2019-12-11 10:35:22
问题 What do you call routing that maps one URL directly to a file? Example: http://localhost/directory/file.php => /var/www/apache/htdocs/directory/file.php What do you call routing like one on https://github.com/nikic/FastRoute? Example: http://localhost/directory/file => request actually goes to a single index.php file, which then loads routing files or tables and loads appropriate class as defined in the routing table. 回答1: What do you call routing that maps one URL directly to a file? I would

php create front-controller to include file from other folder if not exist

老子叫甜甜 提交于 2019-12-11 05:14:09
问题 I'm creating a php front-controller because I need to include file from other folders instead of creating the same file for those that have the same content Example of a directory structure rome - index.php - detail.php - show.php another folder london - index.php (same content as rome/index.php folder) - detail.php (different content as rome/detail.php folder) - show.php (same content as rome/show.php folder) Then london folder must include only detail.php that have different content from

Php site structure

与世无争的帅哥 提交于 2019-12-10 11:57:25
问题 I'm currently in the process of setting my website, largely with php. Though this is my first time using it so I'm running into some problems. I've got the basics of the site down. Registering, login-in, profile page e.t.c. However this is where I seem to have to make a decision about the site layout. For instance. Currently a user's profile page has the URL of mysite.com/profile.php Ideally what I would like is for it to be is something along the lines of mysite.com/user/ChrisSalij From

Zend_Framework- Where to Place $_GET and $_POST (HTTP Request) handling?

扶醉桌前 提交于 2019-12-09 19:13:46
问题 I recently read this post which led to a series of other posts that all seem to suggest the same idea: Models do everything, the View should be able to communicate directly with the model and vice versa all while the Controller stays out of the way. However, all of the examples shown are fairly simplistic and none really show an example of how anyone has tried to implement full handling of of a request / response cycle, which got me to wondering "should the model be responsible for handling

Routing requests through index.php with nginx [closed]

若如初见. 提交于 2019-12-09 18:08:27
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . I'm migrating my server from Apache to Nginx and have this very simple .htaccess rule: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [QSA,L] The idea behind it is to direct every request to a front controller ( index.php ). I'm trying to do the same with Nginx. I used an online

Multi-level controllers for MVC architecture

限于喜欢 提交于 2019-12-08 03:34:36
问题 I just encountered one of the limitations of the MVC architecture I'm currently using for my applications. Currently, my URLs look like this: www.example.com/controller/action Each request arrives at the front controller, which loads the requested controller class from the URL, and executes the action (method) of it. This works fine, until you need to start using nested controllers. Example: There's a 'users' controller which holds methods like createUser(), editUser(), deleteUser() etc. All

PHP Front Controller with MVC

十年热恋 提交于 2019-12-07 22:29:00
问题 I am trying to delve into MVC with Front Controller Design. I want to invoke my entire application by using one line, for example in index.php: require_once(myclass.php); $output = new myClass(); I would love to get rid of the require_once line, but I don't see how I could load my class without including it? Anyway my main question would be how to load my various controllers and models and views etc using a one front end class. So far I have come up with: class myClass { private $name; public

Front controller pattern - is router a front controller?

人盡茶涼 提交于 2019-12-07 10:54:19
问题 I'm trying to understand how a Front Controller should look like. From Wikipedia, The Front Controller pattern is a software design pattern listed in several pattern catalogs. The pattern relates to the design of web applications. It "provides a centralized entry point for handling requests." So, is the code below that handles routes in Slim a front controller? $app = new \Slim\Slim(); $app->get('/books/:id', function ($id) use ($app) { // Get all books or one book. $bookModel = new ...

Routing URL Path with PHP and Apache

老子叫甜甜 提交于 2019-12-06 08:56:46
问题 I am trying to create a nice url structure for my site. My router class will only work if the url is in the style of ?something=value. How do I get it so it will work like: /something/value In my .htaccess I have: Options FollowSymLinks RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule !\.(js|txt|gif|jpg|png)$ index.php?$1 [L,QSA] And in my router class I'm making: class init { function __construct() { $URL = substr($_SERVER['REQUEST_URI'],