Search into an album

I've search into forum several times without find a solution, so i'm gonna explain what i'm looking for.

I'd like to do a search into a certain album, for example now if you search "photo" you'll find all the photos of all the albums that have the word "photo" in their meta. i'd like to have the possibility to do a search of "photo" into just an album, could anybody help me out?

Comments

  • acrylian Administrator, Developer
    The nightly build has the ability to do that but you have to set that specifially with a parameter for the `printSearchForm()` function. See the nightly's template-functions.php file for the details.
  • painful Member
    i've search into the nightly build the file, but it seems like the function printSearchForm looks like the previous one, so no differents i saw in it...
  • acrylian Administrator, Developer
    Then compare and read the documentation before the function:
    New in nightly:
    `function printSearchForm($prevtext=NULL, $id='search', $buttonSource=NULL, $buttontext='', $iconsource=NULL, $query_fields=NULL, $album_list=NULL)`

    Old 1.2.4:
    `printSearchForm($prevtext=NULL, $id='search', $buttonSource=NULL,$buttontext='', $iconsource=NULL)`
  • painful Member
    Allright i got it, i've replaced the function code with the new one...now how can i do the search into a specific album?

    Thanks for the patient...
  • acrylian Administrator, Developer
    By setting the parameter `$album_list` like `array("foldername-of-album-to-search")`. You might need to write a function if you do not want that to be always the same.
  • painful Member
    shame...i thought it was possible just enter into the album for example "flowers", and do the search there with "rose" and display all the photos with "rose" in the meta tag...
  • acrylian Administrator, Developer
    But you can do that: Add the search form to album.php if not already there (as on most themes) and then set the parameter with something like `array($_zp_current_album->name)`. Then the searchform on the album will search only that album.
  • painful Member
    im sorry im not a developer :-)
    The searchform is already in album.php, and i add this

    $album_list = array($_zp_current_album->name);

    just below the function function printSearchForm()

    But it doesn't work...so i'm asking where i have to add the array

    Thanks again for the fast reply...
  • acrylian Administrator, Developer
    You of course need to pass the parameter to the function. After your $album_list definition you need `printSearchForm(NULL, 'search', NULL, 'Seach album', NULL, NULL, $album_list)`.

    Please read also this: http://www.zenphoto.org/2008/04/how-to-read-the-zenphoto-functions-guide/
  • painful Member
    sorry i don't understand...my function is:

    `

    function printSearchForm($prevtext=NULL, $id='search', $buttonSource=NULL, $buttontext='', $iconsource=NULL, $query_fields=NULL, $album_list=NULL) {

    $album_list = array($_zp_current_album->name);

    global $_zp_adminJS_loaded;

    if(empty($buttontext)) {

    $buttontext = gettext("Search");

    } else {

    $buttontext = sanitize($buttontext);

    }

    if (checkforPassword(true)) { return; }

    $zf = WEBPATH."/".ZENFOLDER;

    $dataid = $id . '_data';

    $searchwords = (isset($_POST['words']) ? html_encode(sanitize($_REQUEST['words'],0),false) : '');

    if (empty($buttonSource)) {

    $type = 'submit';

    $buttontext = 'value="'.$buttontext.'"';

    } else {

    $buttonSource = 'src="' . $buttonSource . '" alt="'.$buttontext.'"';

    $buttontext = 'title="'.$buttontext.'"';

    $type = 'image';

    }

    if (empty($iconsource)) {

    $iconsource = WEBPATH.'/'.ZENFOLDER.'/images/searchfields_icon.png';

    }

    if (getOption('mod_rewrite')) { $searchurl = '/page/search/'; } else { $searchurl = "/index.php?p=search"; }

    $engine = new SearchEngine();

    $fields = array_flip($engine->allowedSearchFields());

    if (!$_zp_adminJS_loaded) {

    $_zp_adminJS_loaded = true;

    ?>

    /js/admin.js">

    <?php<br />
    }

    ?>



    <?php<br />
    }

    `

    Where have i add the rest of your code?
  • acrylian Administrator, Developer
    All you need to add is the line I told above. I really recommend that you read our theming tutorial and get a little more familiar with how Zenphoto themes work before trying anything further.
  • painful Member
    obviously i've read your link...but i still don't understand where add the line...
    could you please write me the solution?
  • acrylian Administrator, Developer
    Add it to your theme's album.php and/or image.php. If you don't understand what I am saying please really read the theming tutorial. Of course it is assumed that you have a little knowledge of html and css in general.
  • painful Member
    I did but it got the same result...
    in my album.php i add:

    <div id="search">
    <?php
    $album_list = array($_zp_current_album->name);
    printSearchForm(NULL, 'search', NULL, 'Seach album', NULL, NULL, $album_list);
    ?>

    while in my template-function.php i have:

    function printSearchForm($prevtext=NULL, $id='search', $buttonSource=NULL, $buttontext='', $iconsource=NULL, $query_fields=NULL, $album_list =NULL)

    am i in the right way?
  • acrylian Administrator, Developer
    It does work for me. I assume your really have updated to the nightly build, otherwise it of course will not work. Additionally you also have to set the search fields on the options or via the dropdown correctly.
Sign In or Register to comment.