[Solved]: multiple configs for different themes [Solved]: multiple configs for different themes
 

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

Main Menu

[Solved]: multiple configs for different themes

Started by raetsche, April 16, 2004, 06:07:54 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

raetsche

Hi,

i would like to use two different themes on my website, one for the integration inside my cms (mambo) and one theme for the usage of coppermine in an own browser window. So to speak one "small window" and one "large window" config.
But the problem is that i'd also like to use different values in the themes. For example in the "small" config there should only be 20 thumbnails on the thumbnail page and in the "large" config, there should be 40 thumbanils.

How can i realise different configs for the themes? I know that the config values are saved in the table "cpg11d_config" in the database. But how can i make the theme use a different config-table. For example "large" should use the table "cpg11_config_large". I'd edit the values hardcore. The only thing is to make the theme use a different config.

Can someone give me a hint how to do this?

Thanks in advance for your answer(s)!

Greetz
Frank

raetsche

nobody has got an idea? just a quick hint, where to change it?

Joachim Müller

As I have no idea how mambo integration works, this is just a guess: if the urls differ between the in-mambo and the standalone I'd go for a solution that checks the url and assigns the theme (making it impossible for the user to change the theme) in include/init.inc.php, look for// Process theme selection if present in URI or in user profile
if (!empty($HTTP_GET_VARS['theme'])) {
    $USER['theme'] = $HTTP_GET_VARS['theme'];
}
// Load theme file
if (isset($USER['theme']) && !strstr($USER['theme'], '/') && is_dir('themes/' . $USER['theme'])) {
    $CONFIG['theme'] = strtr($USER['theme'], '$/\\:*?"\'<>|`', '____________');
} else {
    unset($USER['theme']);
}
and modify accordingly.

GauGau

raetsche

thanks for the answer, but that doesn't really solve my problem. With your solution i can assign different themes depending on the url. But assigning different themes is just one point. Using different configs is the other point!

As i mentioned i would p.e. like to show 20 thumbnails in the small theme and 40 thumbnails in the large theme.
As i think by now it's not possible to use different config values depending on the chosen theme because the config values are saved at a central storage point (cpg11d_config in the mysql database), so every theme uses these values.

A solution would be to save different values in the database (p.e. 'albums_per_page' for the small theme and 'albums_per_page_large' for the large theme).

But i also have to be able to use these second values in the theme. And that's the point, i don't know if it's possible that a theme uses these values. I don't know how to reference them.

I have the feeling, that this solution isn't worth the time that has to be spent for it. So if someone with more expierence with coppermine tells me, that he wouldn't do it then i'd also be grateful. I just can not estimate how much work this change means.

Greetz
Frank

Joachim Müller

definitely not worth the work, since a clean second coppermine install takes 5 MB of webspace. If you cut it down to a barebone install (one language, one theme, no docs) you can get away with less than 1 MB.

GauGau

hyperion

As an experiment, you could set up two different installs using the same database.  However, you would then alter init.inc.php of one install to change the config table to a different table name.  Replicate the Config table in the database and put it under this new name. Then if people go to one site, they will get config one, etc.

Another option might be to surround the table definition with an if else clause based on the refferer.
&quot;Then, Fletch,&quot; that bright creature said to him, and the voice was very kind, &quot;let&#039;s begin with level flight . . . .&quot;

-Richard Bach, Jonathan Livingston Seagull

(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fwww.mozilla.org%2Fproducts%2Ffirefox%2Fbuttons%2Fgetfirefox_small.png&hash=9f6d645801cbc882a52f0ee76cfeda02625fc537)

raetsche

the experiment with the second install works really fine!

The steps you have to follow:
-Replicate the config-table
-change init.inc.php as mentioned above
-change the directory for the albums in "settings" for the second installation

@gaugau, hyperion: thank you for the tips!