The discussions here are for Phraw, a micro framework for the PHP programming language.
You are not logged in.
Five cheap websites at the cost of one.
Manea Group is composed by four companies, none of them have a website.
The goal is to make five websites for two events, the first starting in the next Monday, and have at least two days to verify the content with the client. The graphic have to be very similar to the brochure.
The five web sites are the placeholders for the future full websites, are developed only because the urgency and with a very low budget.
The solution used is Phraw 0.4dev using the new routing method (not mod_rewrite), in a single hosting.
The five websites was delivered the day after the order, by one team person, from scratch and optimizing the content. Phraw was a success.
The five websites, in reality, are a single web site in order to save time. The file structure is the following:
lib/
media/
... # logos, photos
resources/
cached/
compiled/
templates/
site1/
base.html
home.html
site2/
base.html
home.html
site3/
base.html
home.html
site4/
base.html
home.html
site5/
base.html
home.html
404.html
base.html
static/
default.css # one CCS file for all the sites
index.php
Every siteX/home.html template extends siteX/base.html that extends base.html. The 404.html template extends the siteX/base.html dinamically simply using a single variable.
The routing is by domain, so I extended the Phraw->route() (inside the Phraw->bulk_route()) method with a custom behavior. The following is the index.php file, quite all the PHP code of the website:
# Domains with custom parameters
$domains = array(
'necaservizi.it' => array('domain' => 'necaservizi.it', 'site' => 'necaservizi', 'name' => 'NECA'),
'imman.it' => array('domain' => 'imman.it', 'site' => 'imman', 'name' => 'IMMAN'),
'maival.it' => array('domain' => 'maival.it', 'site' => 'maival', 'name' => 'MAIVAL'),
'gruppomanea.it' => array('domain' => 'gruppomanea.it', 'site' => 'gruppomanea', 'name' => 'MANEA'),
'gustogiusto.biz' => array('domain' => 'gustogiusto.it', 'site' => 'gustogiusto', 'name' => 'GUSTO GIUSTO'),
);
# Domain routing algorithm
function domain_route(&$domain, &$phraw_uri, &$phraw_uri_values) {
return preg_match('/^(\w+\.)?' . preg_quote($domain) . '$/', $_SERVER['SERVER_NAME'], $phraw_uri_values);
}
# Routing
if ($phraw->detect_no_trailing_slash()) {
$phraw->fix_trailing_slash();
} else if ($phraw->bulk_route($domains, $parameters, 'domain_route')) { # Route by domain with domain_route()
$smarty->assign($parameters); # Parameters of the domain
if ($phraw->route('', 'equal')) {
$smarty->display($parameters['site'] . '/home.html');
} else {
$smarty->display_error();
}
} else {
$smarty->display_error();
}
Offline