Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: Many Domains, one Gallery  (Read 3596 times)

0 Members and 1 Guest are viewing this topic.

RaptorUK

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 45
    • F1 Album
Many Domains, one Gallery
« on: August 16, 2010, 09:31:03 pm »

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

Code: [Select]
if (stripos($_SERVER['SERVER_NAME'], 'f1album'))
 '{GAL_NAME}'= "F1Album" ;
 
else
 '{GAL_NAME}'= "..." ; 
Logged

RaptorUK

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 45
    • F1 Album
Re: Many Domains, one Gallery
« Reply #1 on: August 18, 2010, 02:45:07 pm »

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

Code: [Select]
$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 ?
Logged

Nibbler

  • Guest
Re: Many Domains, one Gallery
« Reply #2 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

Code: [Select]
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');
}
Logged

RaptorUK

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 45
    • F1 Album
Re: Many Domains, one Gallery
« Reply #3 on: August 18, 2010, 09:24:29 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.

Code: [Select]

         $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" ;
Logged
Pages: [1]   Go Up
 

Page created in 0.018 seconds with 19 queries.