Thomas Sutton | 24 Jun 04:15

Re: SPIP sites with multiple domain names

Hi Fil,

On 23/06/2009, at 5:00 AM, Fil wrote:

>> We will be building a SPIP site for a client which will be  
>> accessed using a
>> number of different domain names. Depending on the domain name  
>> used, the
>> site will have to display different content from a different  
>> rubrique or
>> secteur using a different set of templates (product-specific  
>> "micro-sites").
>
> Several sites are already doing this, based on language
> (http://www.poureva.be/ / http://www.vooreva.be/) or based on a
> keyword added to articles (papamamanbebe.net and survivreausida.net).

Good to know. I'm glad I'm not trying to do the impossible.

>> Changing the templates is reasonably easy, if a little cumbersome, in
>> `mes_options.php`:
>
> Yes.
>
> You'll also probably need to change the urls/xxx.php file so that it
> gives the absolute URL with the correct domain too (I can send you
> survivreausida.net's urls file).

That would be very helpful! Thanks!

>> Handling the different content, though, I'm not sure about. My  
>> current plan
>> is to have a sector per site and have `{parent=...}` in the  
>> `sommaire.html`
>> in each template directory, but this is inelegant. Can I add an
>> `{id_secteur=...}` criterion to all (applicable) loops in the  
>> appropriate
>> `case` statement above?
>
> This is a matter of site structure, of course. But you certainly can
> overload the definition of any BOUCLE with a function boucle_XXXX.
> There are examples in
> plugins/zone/exclure_secteur/exclure_sect_fonctions.php:
> function boucle_RUBRIQUES($id_boucle, &$boucles) {

I've seen this, but haven't had cause to look at the Boucle AST or  
the boucle_* functions before. Is there not some global variable to  
add criteria to loops as there is to add filters to all uses of a  
certain tag?

>> Ideally, I'd like to move the above code into a plug-in and manage  
>> all this
>> from the back-end. Which pipeline is appropriate to set the
>> `$dossier_sequelettes` and other globals in this manner?
>
> The plugin would be great.
>
> Any file called in <options>...</options> is called early enough to
> set the globals.

Great! That's even easier than I was expecting. I've started writing  
a plug-in based on what little I have so far (basically just the  
snippet in my first e-mail) and this works well.

> For URLs you'll have to play a bit with the code
>
>> I'm also hoping to get some of the values from `spip_meta` done as  
>> well
>> (`#NOM_SITE_SPIP` and `#URL_SITE_SPIP`, in particular). Is there a  
>> better
>> way to do this rather than overriding `balise_NOM_SITE_SPIP_dist 
>> ($p)`, etc?
>
> For #NOM_SITE_SPIP you could use a <multi>, or override it.
> For #URL_SITE_SPIP you could rewrite the function so that it uses
> $_SERVER['xxxx']
>
>> Finally -- though it should probably have been first :-) -- is  
>> there already
>> a plug-in to do this sort of thing?
>
> No, but once it's coded it will be useful for many people!  (hence,
> tested and supported)

The site this is for will be supported long-term and we're expecting  
to use it on multiple projects in the future, so we will be  
developing and maintaining it for the foreseeable future.

Regards,

Thomas Sutton
bouncingorange

Gmane