Member
Member
painful   2009-05-06, 14:53
#1

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?

Administrator
Administrator
acrylian   2009-05-06, 17:14
#2

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.

Member
Member
painful   2009-05-07, 06:46
#3

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...

Administrator
Administrator
acrylian   2009-05-07, 08:00
#4

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)

Member
Member
painful   2009-05-07, 09:51
#5

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...

Administrator
Administrator
acrylian   2009-05-07, 10:12
#6

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.

Member
Member
painful   2009-05-07, 10:28
#7

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...

Administrator
Administrator
acrylian   2009-05-07, 10:55
#8

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.

Member
Member
painful   2009-05-07, 11:33
#9

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...

Administrator
Administrator
acrylian   2009-05-07, 12:48
#10

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/

Member
Member
painful   2009-05-07, 13:18
#11

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;

    ?>

    " />
Administrator
Administrator
acrylian   2009-05-07, 13:34
#12

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.

Member
Member
painful   2009-05-07, 14:11
#13

obviously i've read your link...but i still don't understand where add the line...
could you please write me the solution?

Administrator
Administrator
acrylian   2009-05-07, 15:32
#14

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.

Member
Member
painful   2009-05-07, 15:46
#15

I did but it got the same result...
in my album.php i add:

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?

Administrator
Administrator
acrylian   2009-05-07, 17:06
#16

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.

  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.