Roundcube Community Forum

 

RC Skin: Dynamic Logo and Faveicon by Domain

Started by raliabdillah, April 17, 2015, 11:30:07 AM

Previous topic - Next topic

raliabdillah

Hi,
I am new in Roundcube...
I want to ask a "Dynamic Logo and Faveicon by Domain" feature in RC skin for multi domain implementation.
Currently, I have to adjust some code in EVERY SKIN. It will be great if this feature provided in every skin.

First, I Create "_CorpLogo" Folder in my Webserver root folder and put our company logos there
DOMAIN_A_Logo.png
DOMAIN_B_Logo.png
DOMAIN_A_favicon.ico
DOMAIN_B_favicon.ico

Then, I did some modification in these config files:

<defaults.inc.php>
$config['default_host'] = 'mail.DOMAIN_B.org';
$config['username_domain'] = 'DOMAIN_B.org';

$config['include_host_config'] = array(
   'mail.DOMAIN_A.com' => 'com_DOMAIN_A.inc.php',
   'mail.DOMAIN_B.org' => 'org_DOMAIN_B.inc.php'
);

<com.DOMAIN_A.inc.php>
$config['main_logo'] = 'DOMAIN_A_logo.png';
$config['favicon_logo'] = 'DOMAIN_A_favicon.ico';

<org.DOMAIN_B.inc.php>
$config['main_logo'] = 'DOMAIN_B_logo.png';
$config['favicon_logo'] = 'DOMAIN_B_favicon.ico';


For EVERY SKIN i want to provide to our users, i have to modify headers, login and links html file, for example, in Larry skin as below:

<Larry SKIN>
<Header.html>
<img src="_CorpLogo/<roundcube:var name='config:main_logo' />" id="toplogo" alt="Logo" onclick="if(window.rcmail)rcmail.command('switch-task','mail')">
<!--<roundcube:object name="logo" src="/images/roundcube_logo.png" id="toplogo" alt="Logo" onclick="if(window.rcmail)rcmail.command('switch-task','mail')" />-->

<Login.html>
<img src="_CorpLogo/<roundcube:var name='config:main_logo' />" id="logo">
<!--<roundcube:object name="logo" src="/images/roundcube_logo.png" id="logo" />-->

<Links.html>
<link rel="shortcut icon" href="_CorpLogo/<roundcube:var name='config:favicon_logo' />" />


Really appreciate if there a feature i can use to simplify this modification.
Thanks,

Roeslan

SKaero

Your doing far more work then is needed, just set the skin_logo config parameter no skin changes needed.

// replace Roundcube logo with this image
// specify an URL relative to the document root of this Roundcube installation
// an array can be used to specify different logos for specific template files, '*' for default logo
// for example array("*" => "/images/roundcube_logo.png", "messageprint" => "/images/roundcube_logo_print.png")
$config['skin_logo'] = null;


Also don't edit the defaults.inc.php edit the config.inc.php so your changes to get overwritten when updating.

MarzuQnx

Quote from: SKaero on April 19, 2015, 04:25:30 PM
Your doing far more work then is needed, just set the skin_logo config parameter no skin changes needed.

// replace Roundcube logo with this image
// specify an URL relative to the document root of this Roundcube installation
// an array can be used to specify different logos for specific template files, '*' for default logo
// for example array("*" => "/images/roundcube_logo.png", "messageprint" => "/images/roundcube_logo_print.png")
$config['skin_logo'] = null;


Also don't edit the defaults.inc.php edit the config.inc.php so your changes to get overwritten when updating.

Hi... can u explain more detail please

Thank u,
MarzuQnx

SKaero

$config['skin_logo'] =  array(
     "*" => "/images/roundcube_logo.png", "messageprint" => "/images/roundcube_logo_print.png", // default logo
     "example.com" => "/images/example_com_logo.png", "messageprint" => "/images/example_com_logo_print.png", // logo for example.com
     "example.org" => "/images/example_org_logo.png", "messageprint" => "/images/example_org_logo_print.png", // example.org
);

MarzuQnx

Quote from: SKaero on August 06, 2015, 04:08:53 PM
$config['skin_logo'] =  array(
     "*" => "/images/roundcube_logo.png", "messageprint" => "/images/roundcube_logo_print.png", // default logo
     "example.com" => "/images/example_com_logo.png", "messageprint" => "/images/example_com_logo_print.png", // logo for example.com
     "example.org" => "/images/example_org_logo.png", "messageprint" => "/images/example_org_logo_print.png", // example.org
);


Now it's so clear... :) I will try this n get back with report.

Regards,

MarzuQnx

Quote from: SKaero on August 06, 2015, 04:08:53 PM
$config['skin_logo'] =  array(
     "*" => "/images/roundcube_logo.png", "messageprint" => "/images/roundcube_logo_print.png", // default logo
     "example.com" => "/images/example_com_logo.png", "messageprint" => "/images/example_com_logo_print.png", // logo for example.com
     "example.org" => "/images/example_org_logo.png", "messageprint" => "/images/example_org_logo_print.png", // example.org
);


hmm.. try this in config.inc.php .. no luck the logo is not changing...

Regards

alec

That is wrong. This does not work this way (see comments in defaults.inc.php). However, you should be able to do some "if ($_SERVER['HTTP_HOST'] == ...." here.

SKaero

Alec is right, I also have a skin switcher for each domain so in my case the solution works.

MarzuQnx

Quote from: SKaero on August 07, 2015, 02:32:05 AM
Alec is right, I also have a skin switcher for each domain so in my case the solution works.

Quote from: alec on August 07, 2015, 02:05:31 AM
That is wrong. This does not work this way (see comments in defaults.inc.php). However, you should be able to do some "if ($_SERVER['HTTP_HOST'] == ...." here.

;) ,  I managed to do it now. skin_logo in the config file is the clue, but still I must edit the parsing process to make it work.

Thanks SKaero for the details use 'skin_logo' in the config.

Regards