Author Topic: Dynamic theming based on domain  (Read 8828 times)

Offline RickMeasham

  • Newbie
  • *
  • Posts: 3
Dynamic theming based on domain
« on: April 18, 2009, 08:56:32 AM »
While I could create one theme per domain and assign that to each user, it seems a little bit of overkill just to change the logo. (And I don't really want people to be able to select someone else's domain theme!) So instead I'd prefer to just load the logo from a PHP file rather than a static image.

How would I pass in the logged-in user's domain? (ie, it's not the domain they're looking at in their browser but the domain for the email account that matters)

Code: [Select]
<roundcube:button command=&quot;mail&quot; image=&quot;/logo.php&quot; alt=&quot;RoundCube Webmail&quot; width=&quot;165&quot; height=&quot;55&quot; />

Somehow I need to include the domain like image="/logo.php?address=foo@example.com" .. but (unless I'm very much mistaken) there's no way to nest tags.

I'm sure I can't be the first person to want to do this .. right?

Cheers!
Rick

Offline rosali

  • Hero Member
  • *****
  • Posts: 2,533
Dynamic theming based on domain
« Reply #1 on: April 19, 2009, 01:01:18 AM »
Code: [Select]

image=&quot;/logo.php?address=<roundcube:var name='session:username'/>&quot;


Notice: On the logon page $_SESSION['username'] is not initialized ...
Regards,
Rosali
__________________
MyRoundcube Project (commercial)

Offline RickMeasham

  • Newbie
  • *
  • Posts: 3
Dynamic theming based on domain
« Reply #2 on: April 19, 2009, 06:12:32 AM »
Sorry, I don't understand. Are you saying I can nest tags?

Offline rosali

  • Hero Member
  • *****
  • Posts: 2,533
Dynamic theming based on domain
« Reply #3 on: April 19, 2009, 06:14:15 AM »
This little bit will give you the  l o g g e d  on username:

Regards,
Rosali
__________________
MyRoundcube Project (commercial)

Offline RickMeasham

  • Newbie
  • *
  • Posts: 3
Dynamic theming based on domain
« Reply #4 on: April 19, 2009, 08:13:22 AM »
OK, tested it and you can't nest tags. Therefore I'm guessing you didn't read my question fully. The logo image is inside a tag. And you can't nest tags, so my questions still stands.

Note this code:
 

I want to change that image attribute to have the session:username included in it.

Offline rosali

  • Hero Member
  • *****
  • Posts: 2,533
Dynamic theming based on domain
« Reply #5 on: April 20, 2009, 12:53:39 AM »

" alt="RoundCube" />


Also you could check in logo.php $_SESSION['username'] and then decide on server side which image should be return by logo.php.

Is it this what you are asking for?
Regards,
Rosali
__________________
MyRoundcube Project (commercial)