PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > php.smarty.general > Running several instances of smarty.
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Running several instances of smarty.

Réponse
 
LinkBack Outils de la discussion
Vieux 01/06/2006, 04h58   #1
Tony K.
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Running several instances of smarty.

I would like to run several subdomains using smarty. Each subdomain
would be a separate instance of smarty. Can I use the same folders
(i.e. template, template_c, cache, configs) for more than one instance
of Smarty?

/domain/template
/domain/template_c
/domain/cache
/domain/configs
/domain/subdomains/subdomain1
/domain/subdomains/subdomain2
....
  Réponse avec citation
Vieux 01/06/2006, 11h05   #2
Marcus Bointon
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [SMARTY] Running several instances of smarty.

On 1 Jun 2006, at 04:58, Tony K. wrote:

> I would like to run several subdomains using smarty. Each subdomain
> would be a separate instance of smarty. Can I use the same folders
> (i.e. template, template_c, cache, configs) for more than one instance
> of Smarty?
>
> /domain/template
> /domain/template_c
> /domain/cache
> /domain/configs
> /domain/subdomains/subdomain1
> /domain/subdomains/subdomain2


Yes. Just set $smarty->template_dir to an absolute path. You will run
into problems with name clashes however - e.g. if domain 1 and 2 both
have an index.tpl, they will point at the same file. Alternatively,
you could create a new resource type that managed multiple template
locations: http://smarty.php.net/manual/en/template.resources.php

Matt Zandstra's talk at the PHP London conference was all about a
structure like this: http://www.phpconference.co.uk/2006/talks/
the_template_path_-_matt_zandstra.html
I'm looking to see if i can find an online version of the talk.

Marcus
--
Marcus Bointon
Synchromedia Limited: Putting you in the picture
marcus@synchromedia.co.uk | http://www.synchromedia.co.uk
  Réponse avec citation
Vieux 01/06/2006, 11h12   #3
Alister Bulman
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [SMARTY] Running several instances of smarty.

On 01/06/06, Marcus Bointon <marcus@synchromedia.co.uk> wrote:
> On 1 Jun 2006, at 04:58, Tony K. wrote:
>
> > I would like to run several subdomains using smarty. Each subdomain
> > would be a separate instance of smarty. Can I use the same folders
> > (i.e. template, template_c, cache, configs) for more than one instance
> > of Smarty?
> >
> > /domain/template
> > /domain/template_c
> > /domain/cache
> > /domain/configs
> > /domain/subdomains/subdomain1
> > /domain/subdomains/subdomain2

>
> Yes. Just set $smarty->template_dir to an absolute path. You will run
> into problems with name clashes however - e.g. if domain 1 and 2 both
> have an index.tpl, they will point at the same file. Alternatively,
> you could create a new resource type that managed multiple template
> locations: http://smarty.php.net/manual/en/template.resources.php
>
> Matt Zandstra's talk at the PHP London conference was all about a
> structure like this: http://www.phpconference.co.uk/2006/talks/
> the_template_path_-_matt_zandstra.html
> I'm looking to see if i can find an online version of the talk.


I use a file I call sandbox.php to setup a number of variables that
can be later used by Smarty to write it's cache and compiled templates
into (then I run an extended smarty object to use them). At the
centre of it, is a directory hierarchy created outside of the document
root (I normally put it based at at /homes/sites/), and then a
directory per site on a per-server-name or http_host-name, which keeps
things seperate.

It may even be worthy of a quick presentation at PHPLondon sometime.

Alister
  Réponse avec citation
Vieux 01/06/2006, 11h31   #4
Jan Rosier
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [SMARTY] Running several instances of smarty.

Marcus Bointon wrote:
> On 1 Jun 2006, at 04:58, Tony K. wrote:
>
>> I would like to run several subdomains using smarty. Each subdomain
>> would be a separate instance of smarty. Can I use the same folders
>> (i.e. template, template_c, cache, configs) for more than one instance
>> of Smarty?
>>
>> /domain/template
>> /domain/template_c
>> /domain/cache
>> /domain/configs
>> /domain/subdomains/subdomain1
>> /domain/subdomains/subdomain2

>
> Yes. Just set $smarty->template_dir to an absolute path. You will run
> into problems with name clashes however - e.g. if domain 1 and 2 both
> have an index.tpl, they will point at the same file. Alternatively,
> you could create a new resource type that managed multiple template
> locations: http://smarty.php.net/manual/en/template.resources.php

Or use compile_id to avoid name clashes.
For example:
$smarty->compile_id = $_SERVER['HTTP_HOST'];


Greetings,
Jan Rosier
  Réponse avec citation
Vieux 02/06/2006, 08h54   #5
Pedro
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Running several instances of smarty.

Tony K. wrote:
> I would like to run several subdomains using smarty. Each subdomain
> would be a separate instance of smarty. Can I use the same folders
> (i.e. template, template_c, cache, configs) for more than one instance
> of Smarty?
>
> /domain/template
> /domain/template_c
> /domain/cache
> /domain/configs
> /domain/subdomains/subdomain1
> /domain/subdomains/subdomain2
> ...


Am doing exactly as your suggesting....
I have one file "common_config.php" that contains the smarty init code
and the following 2 lines
$smarty->compile_id = $_SERVER['SERVER_NAME'];
$smarty->compile_dir = '/www/shared_smarty_compile_dir';

have fun
Pete
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 16h12.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,12543 seconds with 13 queries