print_album_menu question

I really like the new way plugins are being managed in ZP 1.1.6. I'm currently playing around a little with integrating the print_album_menu into a theme, but I'm wondering if there's a way of limiting the number of albums it lists when using the "list" option instead of the dropdown menu. I'd like to have it so it lists, for example, the 10 most recently added albums.

Or perhaps there's another way of achieving this, outside of using the album menu plugin? I'll admit my PHP is limited, but any suggestions on how to accomplish this would be greatly appreciated.

Comments

  • acrylian Administrator, Developer
    Since the album menu is a menu it is clearly not meant for this and there is no way unless you want to code yourself. But we have a function for the latest albums: http://www.zenphoto.org/documentation-official/zenphoto/_plugins---image_album_statistics.php.html#functionprintLatestAlbums

    This of course shows the thumbs of the latest albums.
  • Right. Except I don't want the album thumbs to show up, only a text links list. Since my list of albums is rather long, I didn't want all of them to be listed (I wanted to integrate the album menu as a sidebar menu, clearly a use for which it was designed, I'm sure).

    Thanks, anyway.
  • acrylian Administrator, Developer
    Right, the menu was designed for that, but not for the latest x albums..:-)

    I would suggest that you take a look at the plugin image_album_statistic.php that has the function for latest albums. The nightly build's version has been updated to optionally show title, desc and date. Since Zenphoto is about images I never thought of skipping them.... Would be not that hard, maybe I add that as an option.

    Meanwhile, you could double and rename that function and make a custom function for your theme where you take out the image display. Of course you could just "hack" that function but you will have to remember that with any further updates. See our theming tutorial about the usage of custom functions.
  • wilsul Member
    Can the code below be used to show latest albums on the main page?

    `<?php define('ZENFOLDER', 'zp-core');<br />
    define('WEBPATH', 'pasteventsv3');

    require_once (WEBPATH . "/" . ZENFOLDER . "/template-functions.php") ; //load extensions

    $_zp_plugin_scripts = array();

    $_zp_flash_player = NULL;

    $curdir = getcwd();

    chdir(SERVERPATH . "/" . ZENFOLDER . PLUGIN_FOLDER);

    $filelist = safe_glob('*'.'php');

    chdir($curdir);

    foreach ($filelist as $extension) {

    $opt = 'zp_plugin_'.substr($extension, 0, strlen($extension)-4);

    if (getOption($opt)) {

    require_once(SERVERPATH . "/" . ZENFOLDER . PLUGIN_FOLDER . $extension);

    }

    }

    ?>

    <?php void printLatestAlbums( [string $number = 5], [ $showtitle = true], [ $showdate = false], [ $showdesc = false], [ $desclength = 40] ) ?>`
  • Not quite. functions in PHP are called by listing the function name followed by the parameters enclosed in open and close parens. So the code you want from your example above is:

    `printLatestAlbums(5, true, false, false, 40);` or if you just want to use the default values as shown in the document `printlatestAlbums()`
  • wilsul Member
    thanks now it works, and is showing the latest albums but the path to the album is not showing good.

    My zenphoto is located in a folder called pasteventsv3/zp-core

    albums are showing www.site.com/album not www.site.com/pasteventsv3/album

    how can i solve this?
  • acrylian Administrator, Developer
    You just found a bug....:-( I will take care of that.

    EDIT: Sorry, not a bug, please check your htaccess file and run setup again. Maybe you forgot to copy thte included htaccess file.
    Also try disabling mod_rewrite in the options.
  • wilsul Member
    I checked the htacces, and run setup again,
    in the theme the links are fine, but with this code no, so that i can show the latest albums on another page.
    `<?php define('ZENFOLDER', 'zp-core');<br />
    define('WEBPATH', 'pasteventsv3');

    require_once (WEBPATH . "/" . ZENFOLDER . "/template-functions.php") ; //load extensions

    $_zp_plugin_scripts = array();

    $_zp_flash_player = NULL;

    $curdir = getcwd();

    chdir(SERVERPATH . "/" . ZENFOLDER . PLUGIN_FOLDER);

    $filelist = safe_glob('*'.'php');

    chdir($curdir);

    foreach ($filelist as $extension) {

    $opt = 'zp_plugin_'.substr($extension, 0, strlen($extension)-4);

    if (getOption($opt)) {

    require_once(SERVERPATH . "/" . ZENFOLDER . PLUGIN_FOLDER . $extension);

    }

    }

    ?>

    <?php printLatestAlbums(5, true, true, false, 40); ?>`
  • acrylian Administrator, Developer
    Then it must be related to the ZENFOLDER and WEBPATH definitions. So I assume the page you want to show the latest albums on is on top level?
  • wilsul Member
    yes
  • wilsul Member
    this is the result html i get
    `

    `
  • wilsul Member
    i solved it by adding the folder name in the following code on image_album_statistics.php
    `function printAlbumStatisticItem($album, $option, $showtitle=false, $showdate=false, $showdesc=false, $desclength=40) {

    global $_zp_gallery;

    $tempalbum = new Album($_zp_gallery, $album['folder']);

    echo "name)."\" title=\"" . $tempalbum->getTitle() . "\">n";

    echo "imagegetAlbumThumb()."\">
    n
    ";

    if($showtitle) {

    echo "

    name)."\" title=\"" . $tempalbum->getTitle() . "\">n";

    echo $tempalbum->getTitle()."
    n";

    }`

  • acrylian Administrator, Developer
    Ok, I see you apparently were using the 1.1.6, please try also the nightly, that corrects some issue in that plugin.
Sign In or Register to comment.