Many Domains, one Gallery Many Domains, one Gallery
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Many Domains, one Gallery

Started by RaptorUK, August 16, 2010, 09:31:03 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

RaptorUK

Hi, my gallery (1.5.8) is at www.F1Album.com ,   it's also at www.BTCCAlbum.com  and a few others besides . . .  it's all the same gallery just with different Domains.

I'd like to reflect the Domain name in the Gallery Name  ( {GAL_NAME} ),  for example  for www.f1album.com  F1 Album,  for  www.bttcalbum.com  BTCC Album,  you get the idea.

A friend has suggested some ideas but the coding is beyond me.  I've done some bits of coding in the past but very, very little php.

I tried adding this to my relevant  theme.php . . .  it didn't work and with my little knowledge I'm stuggking to know if it's in the correct file or if the synatx is correct . . .

if (stripos($_SERVER['SERVER_NAME'], 'f1album'))
'{GAL_NAME}'= "F1Album" ;

else
'{GAL_NAME}'= "..." ; 

RaptorUK

Ok,  I'm understanding the syntax a little better now,  I understand that the {GAL_NAME} is an entry in an array.

I think I understand how to change that entry . . .

$template_vars = array(
        '{GAL_NAME}'=> "F1Album",       
        );


putting it in the template.php hasn't done the job though.  I assume it gets read somewhere else after template.php . . .  and overwrites my change ?

Nibbler

Easiest way would be to change the variable itself instead of the theme placeholder, so use something like this in your theme.php


switch ($superCage->server->getRaw('HTTP_HOST')) {

    case 'example1.com':
        $CONFIG['gallery_name'] = 'Welcome to Example1';
    break;

    case 'example2.com':
        $CONFIG['gallery_name'] = 'Welcome to Example2';
    break;

    case 'example3.com':
        $CONFIG['gallery_name'] = 'Welcome to Example3';
    break;
   
    default:
        $CONFIG['gallery_name'] = 'Welcome to ' . $superCage->server->getEscaped('HTTP_HOST');
}

RaptorUK

Quote from: Nibbler on August 18, 2010, 08:34:34 PM
Easiest way would be to change the variable itself instead of the theme placeholder, so use something like this in your theme.php


Thanks a bunch   ;D  I owe you a pint   :D  just the help I needed . . . .

In the end I did this,  seems to do exactly what I wanted.



         $CONFIG['gallery_name'] =  "F1 Album/BTCC Album" ;       


if (stripos(($superCage->server->getRaw('HTTP_HOST')), 'f1') !== false )
 
       $CONFIG['gallery_name'] = "F1 Album" ;


if (stripos(($superCage->server->getRaw('HTTP_HOST')), 'btcc') !== false )
 
       $CONFIG['gallery_name'] = "BTCC Album" ;


if (stripos(($superCage->server->getRaw('HTTP_HOST')), 'heldinmemory') !== false )
 
       $CONFIG['gallery_name'] = "Held in Memory" ;