473,386 Members | 1,864 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Using Just One Entry Point For An Entire Dynamic Site

Hi,

I'm thinking of an architecture for a medium-complexity dynamic site
as follows:

- I use one php file, say a.php as the entry point for the entire
site. PATH_INFO allows me to pass information to my script by using
URLs like http://mysite.com/a.php/user1000 or
http://mysite.com/a.php/images/10.gif and perform the appropriate
action by calling the appropriate function (which may reside in an
included php file)

- I use apache's url rewriting to redirect urls like
http://mysite.com/page25 to a.php b adding the script name -
http://mysite.com/a.php/page25

- Using Smarty to control the actual HTML output.

This seems to me like a sound and obvious way to do things (and also
rarely done) so my questions are:

- Has anyone on this group tried to do or done something like this
before, using one entry point for the entire site for maximum control?

- If so, what do you think are the pros and cons or this approach?

Regards,
Seun Osewa
Jul 17 '05 #1
3 2439
Seun Osewa wrote:
- Has anyone on this group tried to do or done something like this
before, using one entry point for the entire site for maximum control?
This pattern is known as "Front Controller" (Martin Fowler, Patterns of
Enterprise Application Architecture), as opposed to "Page Controller",
where you have one .php file for each "page" in the application. There
are a good few applications that use it, like e.g. phpnuke and postnuke.
- If so, what do you think are the pros and cons or this approach?


Don't have the time to go into this now, but this is a very
controversial topic, with followers of both patterns deeply entrenched ;-)

For a start, take a look at this article, which also has some further links:
http://phppatterns.com/index.php/art...leview/81/1/1/

Jochen

Jul 17 '05 #2
"Seun Osewa" <se*******@inaira.com> wrote in message
news:ba**************************@posting.google.c om...
Hi,

I'm thinking of an architecture for a medium-complexity dynamic site
as follows:
- I use one php file, say a.php as the entry point for the entire
site. PATH_INFO allows me to pass information to my script by using
URLs like http://mysite.com/a.php/user1000 or
http://mysite.com/a.php/images/10.gif and perform the appropriate
action by calling the appropriate function (which may reside in an
included php file)
..........
- Has anyone on this group tried to do or done something like this
before, using one entry point for the entire site for maximum control?


I just did something like this last night as a test.

I created a dir like this

/mirrors/site1/content
/mirrots/site2/content
in each siteX dir I placed an index.php file

then in my vurtual host conf file I put:
<VirtualHost ......>
ServerName site1.blablabla.com
ServerAlias site2.blablabla.com
DocumentRoot /mirrors/

ErrorDocument 404 /mirrors/
</VirtualHost>
then I put this is /mirrors/
index.php
------------------
<?
$h = $_SERVER['HTTP_HOST']]
$r = $_SERVER['REQUEST_URI'];

if ($r == "/")
$r = "index.html";

if ($h == "site1.blabla.com")
$d = "site1";

if ($h == "site1.blabla.com")
$d = "site2";

readfile("$d$r");
exit();
?>
then I just stuffef plain copies of .html website into the mirrors/siteX

Now the script actualy does the serving, so I can filter it too. or do what
every I want to each request.

This was another one of those, can I do it, a solution, in seach of a
problem.

--
Mike Bradley
http://gzen.myhq.info -- free online php tools

Jul 17 '05 #3
Thanks.

I finally decided to go with Java because its more natural with this
kind of design with its persistent objects and all.

Jochen Buennagel <za*********@buennagel.com> wrote in message news:<bt*************@news.t-online.com>...
Seun Osewa wrote:
- Has anyone on this group tried to do or done something like this
before, using one entry point for the entire site for maximum control?


This pattern is known as "Front Controller" (Martin Fowler, Patterns of
Enterprise Application Architecture), as opposed to "Page Controller",
where you have one .php file for each "page" in the application. There
are a good few applications that use it, like e.g. phpnuke and postnuke.
- If so, what do you think are the pros and cons or this approach?


Don't have the time to go into this now, but this is a very
controversial topic, with followers of both patterns deeply entrenched ;-)

For a start, take a look at this article, which also has some further links:
http://phppatterns.com/index.php/art...leview/81/1/1/

Jochen

Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Simon Harvey | last post by:
Whato chaps, I work (or am hoping to work! :) for a company that specialises in the following: - Localisation of media - including software, manuals, literature and training material. -...
7
by: Forecast | last post by:
I run the following code in UNIX compiled by g++ 3.3.2 successfully. : // proj2.cc: returns a dynamic vector and prints out at main~~ : // : #include <iostream> : #include <vector> : : using...
13
by: Stumped and Confused | last post by:
Hello, I really, really, need some help here - I've spent hours trying to find a solution. In a nutshell, I'm trying to have a user input a value in form's textfield. The value should then be...
2
by: Paul Duncan | last post by:
diggityduncs (Programmer) Nov 13, 2003 Hello, I'm tring to use a win32/api dll in c# The vendor I received the dll from doesn't know anything about .net I received two files ACGAPI.DLL +
1
by: Nick | last post by:
I am working on a website for a client and one of their requirements was to have a mailing list. I decided to XSLT to transform "templates" to HTML so that editing was very easy and less time...
2
by: Maria.Reinhammar | last post by:
I have an app using active_directory.py and the std module asyncore in a Windows Service. Works perfectly! That is, until I try to use py2exe to create a standalone (need to avoid installing the...
6
by: Dhananjay | last post by:
hello everyone i have got a problem i want to design business layer, data access layer , presentation layer for asp.net using C#.net , can anyone help me to solve this problem. i want some...
6
by: =?Utf-8?B?YzY3NjIyOA==?= | last post by:
Hi all, I am thinking about doing this since I got several cases that some of our internal users open more than one browser at the same time from our server. When one of the transactions was not...
18
by: Angus | last post by:
Hello We have a lot of C++ code. And we need to now create a library which can be used from C and C++. Given that we have a lot of C++ code using classes how can we 'hide' the fact that it is...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.