Home > Archive > PHP Smarty Templates > August 2005 > Streamlining sites.
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Streamlining sites.
|
|
| George Pitcher 2005-08-30, 7:57 am |
| Hi,
I have five sites using the same code, apart from images and database
connection.
I wanted to set them up so that they share the code and a config file sets
up the individual bits.
I'm currently on IIS so this is how I went about it.
Set up a folder containing the php files. In that folder I have the
following:
folders
--templates
--images (contains common images used across all sites)
and for each website
--site_includes (contains config and image files)
--site_templates_c
--site_cache // added later
--site_configs // added later
For 'site' above, I replace with the virtual host name as used by IIS.
I then set IIS to point the various virtual hosts to that main folder and
the home.php checks the 'ORIG_PATH' to know which site it is in and then
calls the appropriate site_includes folder and stores the 'site' in a
cookie.
Initially, I figured that the individual site_templates_C would keep the
data from mixing across sites but that didn't work and I had images failing
to display correctly and data traversing across the sites. I then created
individual site_cache and site_configs folders for each site and that seems
to be working fine.
This might help someone else out the wanting to do something similar with
Smarty. I'm not sure how this works with Apache, but As I'm migrating to
Apache2 (win2003) in the new year, I'm going to find out.
Cheers
George
| |
|
| >>> site_templates_c
$smarty already has a $compile_id var to help with this.. Thi smeans one
can have one shared compile dir across all sites
http://smarty.php.net/manual/en/variable.compile.id.php
$smarty->compile_id = $_SERVER['SERVER_NAME'];
$smarty->compile_dir = 'path/to/shared_compile_dir';
This is really useful - particullarily when upgrading smarty
Pedro
George Pitcher wrote:
> Hi,
>
> I have five sites using the same code, apart from images and database
> connection.
>
> I wanted to set them up so that they share the code and a config file sets
> up the individual bits.
>
> I'm currently on IIS so this is how I went about it.
>
> Set up a folder containing the php files. In that folder I have the
> following:
>
> folders
> --templates
> --images (contains common images used across all sites)
> and for each website
> --site_includes (contains config and image files)
> --site_templates_c
> --site_cache // added later
> --site_configs // added later
>
> For 'site' above, I replace with the virtual host name as used by IIS.
>
> I then set IIS to point the various virtual hosts to that main folder and
> the home.php checks the 'ORIG_PATH' to know which site it is in and then
> calls the appropriate site_includes folder and stores the 'site' in a
> cookie.
>
> Initially, I figured that the individual site_templates_C would keep the
> data from mixing across sites but that didn't work and I had images failing
> to display correctly and data traversing across the sites. I then created
> individual site_cache and site_configs folders for each site and that seems
> to be working fine.
>
> This might help someone else out the wanting to do something similar with
> Smarty. I'm not sure how this works with Apache, but As I'm migrating to
> Apache2 (win2003) in the new year, I'm going to find out.
>
> Cheers
>
> George
|
|
|
|
|