ThemeSwitcher - problem with cookie

Hi,
I have a ZenPhoto album create on my server.
I have created three different themes according to their own design, so users do not realize that they left the site when they access the album, as the look is identical.
http://www.mydomain.com/gallery/?themeSwitcher=theme1
http://www.mydomain.com/gallery/?themeSwitcher=theme2
http://www.mydomain.com/gallery/?themeSwitcher=theme3
It works great. The biggest asset is to keep only one album to update. This is great!
But, there is a little problem with the cookie. For example, if a user access theme1 (index page), then browse the beach album and leave the site. If the same user now access theme2, then beach album. The theme is switching back to the first theme, which is really confusing for users. I have setup the cookie duration for 5 minutes, which is probable enough for most user.
My question is … Is there a way to modify [themeSwitcher.php] to clear previous cookie while loading new theme ?
Thanks and sorry for my English!

Comments

  • acrylian Administrator, Developer
    I am not sure I fully understand what you are trying to do. The theme switcher is more a tool to globally switch the theme, as a kind of demo (as we do on our demo). Have not tried this I think.

    Is your goal maybe to use different themes/looks for specific albums? Then there would be much better ways to do that:
    a) Assign album themes: the older way to assign themes to specific albums, default function available on each album backend page
    b) using multiple_layouts plugin: The much better and newer way to assign specific layouts to albums (and other pages) from within the same theme
  • fretzl Administrator, Developer
    ...and since you have everything on the same server you can still use a single external album folder to serve all.
    Simply modify /zp-data/zenphoto.cfg.php to point to the external album on the server. The comments in the file will explain how to.
  • fretzl Administrator, Developer
    You may also want to look at the possibilities of the cloneZenphoto plugin.
  • Thanks.
    You made me think of something new.
    In zenphoto.cfg.php, when I replaced ...
    $conf['album_folder'] = '/albums/';
    $conf['album_folder_class'] = 'std';
    by ...
    $conf['album_folder'] = '/home/username/public_html/gallery/albums/';
    $conf['album_folder_class'] = 'external';
    I can now see all albums, but without any title (caption) which is normal as this information is stocked in a sql outside of this particular installation.
    What I can do, is to install a fresh zenphoto within each site, then keep only one site (I call main site) with albums and caption, then modify the zenphoto.cfg.php of the two other sites to point to the main. This way each sites will have its own theme, but sharing albums.
    BUT what about caption (title for album and image) for the two other sites?
    Is there a was to get the info from the (main site) sql ?
  • acrylian Administrator, Developer
    Separate installs are separate installs. Unless you embed titles etc into the images they need to be added on each. Especially on albums itself as that cannot be embeded.

    You would have to share the same database but that probably won't work.

    Maybe you can somehow sync the albums and images tables between all three installs. If you don't update that often you could try that manually via phpMyAdmin or similar.

    Nevertheless I still didn't fully understand why you need three separate sites with the same content ;-)
  • Sorry for the bad explanation :-)
    My gallery is about a travel destination of three islands (meaning three separated websites) that are separate by few kilometers.
    My gallery contain roughly 2,000 images of hotels, beaches, sights, excursions, etc.
    One gallery shared by three websites is perfect. HOWEVER, the look of each sites is different. That is why I do not want to duplicate my gallery three times (same content) as it would be crazy to maintain after updating the gallery.
    I know, this is something out of ordinary!
    Thanks again for your help. I do not want bother you guys with my crazy project! :-)
  • acrylian Administrator, Developer
    No problem with "crazy projects" ;-) It's just easier trying to help if you understand the reasons.
  • One last question :-)
    ThemeSwitcher uses cookies to store time session.
    If I want to clear cookie of a particular theme, by processing this code ...

    zp_setCookie(themeSwitcher_theme, 'theme123', -368000);

    Is it enough ? or do I have to run other command to remove the cookie created by themeSwitcher (like unset) ?
  • acrylian Administrator, Developer
    There is also a function `zp_clearCookie()` doing this.
Sign In or Register to comment.