Make theme options specific to each theme

In the admin panel options/theme options the "standard options" including albums/images per page, thumb size, crop width/height size are apparently applied to all themes, regardless of individual theme differences in thumbs sizes and thumbs per page.

Why are "These image and album presentation options standard to all themes"?

I find this behavior very odd. Would it not be more sensible to make the theme options specific to each theme? Then we could simply select one theme or another and not have to also change the above theme parameters for each theme, each time we switch a theme.

For instance right now, if I have two themes, one with thumbs sized 100x100 and 12 images per page, and the other with thumbs 80x80 and 20 images per page, each time I switch my theme from the first one to the second one I also have to change the "standard options", otherwise my theme does not display correctly. On the other hand, if the theme options would apply specifically to each theme, then I would not have this problem.

Would it not make more sense to make "theme options" specific to themes?

Comments

  • acrylian Administrator, Developer
    Generally Zenphoto allows one theme at the time except for album themes but these have their own settings.

    Anyway, you can do this purely with your theme directly if that requires special settings. You can override all options within them so that you will not have to think of changing options everytime.
  • I tried overriding the thumb size using printCustomAlbumThumbImage(), instead of printAlbumThumbImage in my index.php. However somehow the admin settings took priority and I still got thumbs with the admin specified size and number of thumbs per page, instead of the ones set in my theme. As soon as I changed the settings in the admin panel, the theme worked as expected (but I had to use the old printAlbumThumbImage).
  • acrylian Administrator, Developer
    That should not happen, if that will most likely be a bug. Was that with 1.2.2 or the nightly?

    You can override the thumbs aka albums per page with this `<?php setOption("albums_per_page",<number>,false); ?>` for example.
  • It is the 1.2.1. I am waiting to install the release after 1.2.2, as I see on the forum there seem to be a few bugs in 1.2.2, especially with thumb resizing.
  • Regarding the <?php setOption("albums_per_page",<number>,false); ?>,
    isn't the NormalizeColumns already supposed to override the thumbs per page set in the admin panel?
  • acrylian Administrator, Developer
    So why don't you use 1.2.1 and not 1.2.2 then? We had some bugs that were related to the maxspace functions that of course are related to the image functions in general.

    Actually that is why you should try the nightly. If we don't get enough testings of that bugs can go into 1.2.3 again. That will help us. Thanks.

    normalizeColumns is an actually optional helper function that helps to equal display if you have albums with images and subalbums. You don't need to use that if you don't have both in your albums. Please read the lengthly explanation on the functions guide for that.
  • Well, I tried again. I have the admin theme options set to 12 thumbs per page, thumbs 100 and crop 100, 100 and I tried the following in index.php of my theme:

    setOption("albums_per_page",20,false); normalizeColumns(5, 4);
    and
    printCustomAlbumThumbImage(getAlbumTitle(),null,80,80);

    This time it worked for the index page.

    But I did not find the similar function to print custom sized thumbs for the album.php page, something like printCustomImageThumb(getAlbumTitle(),null,80,80).

    So I tried the only thing that seems similar in the functions guide - printCustomSizedImageThumbMaxSpace() but it generated an undefined function error.
  • acrylian Administrator, Developer
    For custom thumbnails of images (not album thumbs) you can just use the customsizeimage functions. There are none for thumbs specifically.

    normalizeColumns is actually only needed if you have albums that contain subalbums and images. If you only have images OR subalbums in your albums you actually can just remove that function.

    The maxspace functions contain bugs in 1.2.2, you need to use the nightly build to use them.
  • To get custom sized thumbs and number of thumbs/page, I tried on the album.php page the following:

    setOption("albums_per_page",12,false);
    <?php printCustomSizedImage(getImageTitle(),null,100,100); ?>

    It did print thumbs sized 100x100, but 20 of them per page (as set in admin), not 12, as requested in the theme.

    This is the code from albums.php:

    <!-- Images -->
    <?php while (next_image(false, $firstPageImages)): ?>
    <div class="thumb">
    <a rel="floatbox.pix" rev="type:img
    href:`<?php echo getCustomImageURL(null,null,540);?>`"
    href="<?php echo htmlspecialchars(getImageLinkURL());?>"
    title="<?php echo getImageTitle();?>">
    <?php printCustomSizedImage(getImageTitle(),null,100,100); ?>

    <p class="caption"><?php echo getBareImageTitle();?></p>
    </div>
    <?php endwhile; ?>

    On the other hand, the setOption("albums_per_page",12,false);
    printCustomAlbumThumbImage(getAlbumTitle(),null,100,100);
    used on the index.php page did produce a page of 12 thumbs.
  • acrylian Administrator, Developer
    Yes, it shows 20 because you set the option for albums per page. If you want to override the setting for thumbs per page you need of course to use `setOption("images_per_page",12,false);`
  • OK, I see, and thank you for noticing that, it worked like a charm!
  • Fotos Member
    i have the problem that zenphoto shows 2 pictures more than what i selected in the options. maybe this could fix my problem - thanks.
  • I came to a similar conclusion as marcov, which is how I found this post.
    What I'm wondering is if there is a way to hide the Standard options that do not apply to the theme since some of them may not be used by the current theme.

    This would decrease the likeliness for the user to get confused by setting irrelevant settings that seem to make no difference and leading to their frustration and complete waste of time setting them to begin with.

    It'd probably be great to have this as a feature to the themeoptions.php file since that's where the Custom theme options are added.
    Anywho, just a thought....
  • You should create a ticket for a feature request to hide these options. I am sure that we could figure out a way.
Sign In or Register to comment.