News

Theme design changes in Zenphoto 1.4

    Note: This article already had been published in September 2009 under the title "Theme design changes that will appear in Zenphoto 1.3.2". Since 1.3.2 was skipped in favor of 1.4 it is now being republished.

    With the 1.4 release we have undertaken some revisions to how themes should normally be coded. They are summarized below:

    New filters have been defined to allow plugins to insert HTML in strategic locations on the WEB page.

    1. theme_head: Every theme should include a call on zp_apply_filter('theme_head'); within the heading ( <head></head> ) tags of the page. This function replaces the call on zenJavascript(); of older Zenphoto versions. That function is now deprecated. You can continue to use it while transitioning to the new call by enabling the deprecated_functions plugin. Plugins which used the addPluginScript() function should instead create a filter for theme_head.
    2. theme_body_open: There should be a call on zp_apply_filter('theme_body_open'); just after the <body> HTML tag of the page.
    3. theme_body_close: There should be a call on zp_apply_filter('theme_body_close'); just beforethe </body> HTML tag of the page.


    The management of image and album thumbnails per "row" has been regularized and incorporaed with the theme options. Themes which wish tocustomize these should add setThemeDefault() function calls in their option handler object to set the default values for albums_per_row, images_per_row, and thumb_transition. The latter controls whether image and album thumbs will share a transition page or will be on separate pages.

    As a result of this change, the function normailzeColumns() has been deprecated. If you enable the deprecate_ functions plugin and use this function it will simply set the options for images_per_row and albums_per_row.

    Special note for plugin designers. The function addPluginScript() has also been deprecated by these changes. Since you may not control whether the deprecated_functions plugin is enabled you can use the following code template to insure that your plugin is compatible with all release versions.

    if (version_compare(ZENPHOTO_VERSION,'1.4.0') < 0) {
    ob_start();
    xxx_plugin_JS();
    $str = ob_get_contents();
    ob_end_clean();
    addPluginScript($str);
    } else {
    zp_register_filter('theme_head',' xxx_plugin_JS');
    }


    function xxx_plugin_JS() {
    <your script HTML gets output here>
    }

     

     

     

     

    For questions and comments please use the forum or discuss on the social networks.

    Related items