Contextual search

Hi guys,
i am trying to create a search button that will retun results contained only in the current album (and its sub albums).
I use this variable of the printSearchForm function:
`array $album_list: optional array of albums to search`

I try to create my array (I'm a zero in php, I only use AS3 ...)
But I don't know what to give to the fuction ( album id, name ?) and how to give it (php syntax, ZP ignorance ...)
See my last attempt

` <div id="jump-search" class="clearfix">
<?php
$album_list = getAllSubAlbumIDs(); // THIS IS THE CRITICAL LINE !!!
?>

<?php if (getOption('Allow_search')) { printSearchForm( '','searchform','',gettext('SEARCH'),"$_zp_themeroot/images/search-drop.png",NULL,$album_list ); } ?>
<?php if (function_exists('printAlbumMenu')) { printAlbumMenu('jump'); } ?>
</div>`

Thanks for your help !
bye

Comments

  • The `$album_list` variable should be an array of folder names for each album you want included in the search.

    Please do note, however, that `printSearchForm()` will be changing in the next release. After 1.3.2, the format of `$album_list` will change to be a multi-dimensional array, so you should pass the list in the form of:

    `array('albums' => $album_list);`
  • Thanks kagutsuchi,
    So how can I create the $album_list array to contain the name of the current album and its subalums ?
  • I'm not sure whether or not an album automatically includes its subalbums or not. If it does, then you should simply be able to add `$_zp_current_album->name` to the array. If not, then you will have to manually add its subalbums to the array.
  • Got it !
    `
    $album_list = $_zp_current_album->getAlbums();
    $album_list[] = $_zp_current_album->name;

    if (getOption('Allow_search')) { printSearchForm( '','searchform','',gettext('SEARCH'),"$_zp_themeroot/images/search-drop.png",NULL,$album_list ); }
    `
Sign In or Register to comment.