Fil | 22 Jun 23:00
Favicon
Gravatar

Re: SPIP sites with multiple domain names

> 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).

> 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).

> 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) {

> 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.

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)

-- Fil

Gmane